.htaccess

Using .htaccess to serve static files via a subdomain

Right, excuse my stupidity, I've looked through a load of examples on t'interweb but I don't think I've found what I'm looking for. I have a website, photography.example.com is the main site but I also want to have another subdomain to serve static files, for example static.photography.example.com. If I request a file (e.g. http://stat...

Are there any resources on the correct ordering of Apache .htaccess directives?

I was tweaking my .htaccess file for the first time, and ran into the problem where my custom 404 page would not load because I placed the Options -Indexes directive after the ErrorDocument 404 directive. Seeing as ordering directives willy-nilly can easily break the intended behavior, is there any online resource that details what the c...

Conditional .htaccess rules for same URL

What is the best method to combine the following two rules into one, so that users can visit domain.com/schedule and also domain.com/schedule/{day} The rule should forward to the same controller, where I will then check the parameter RewriteRule ^schedule/?$ index.php?_orn_shows_action=view-schedule [NC,QSA,L] RewriteRule ^schedule/([a...

Alias Domain to Zend Directory

I have a ZF website at domainA.com and I'd like to alias domainB.com to something like: domainA.com/photos/album so that album would be the root of domainB. How might this be accomplished? ...

Domain based redirect to different PHP files via htaccess

Domain based redirect to different PHP files via htaccess Hello there. Here's the thing: I have two domains here [http://www.myproject.com and [http://www.myproject.com.br .. In my root folder i have all the stuff for my projects including two "indexes": "index-en.php" for english and "index.php" for portuguese. Can i have some trick...

how to redirect request based wether a query string value is present?

Hi, I've searched and tried many examples but none seem to work for me. I need to redirect a request to a specific url depending on if the original request had a certain item in it's query string. e.g. www.mydomain.com/test.html?username=foo&password=bar So I want to redirect this only is the username variable is present in the query...

.htaccess Redirect on a url with spaces in it

Hello I have a link from anther website that I do not have control of http://domain.com/one two three.exe The correct URL is http://domain.com/one_two_three.exe Note: Underscores instead of spaces. I searched the internet and found this code snippet for .htaccess # Redirect old file path to new file path Redirect /one%20two%20th...

HTaccess rewrite rule

Hi all. I have a webpage http://mydomain.com/form.php?id=123 , I need to keep this format for old functionality , and to implement a new functionality so the user could access this page like this http://mydomain.com/123. So the client will see this http://mydomain.com/123. And the server will understand as old version http://mydomain....

Rewrite .php to .aff and treat .aff as php

Hello, On my website I have an affiliates/ folder. Inside that I have showgames.php I want to be able to access the file as www.website.com/affiliates/showgames.aff Inside affiliates folder,I placed this .htaccess AddType application/x-httpd-php .php .aff RewriteEngine on RewriteBase / RewriteRule ^(.*)\.php$ $1.aff [R=permanent] ...

Testing if gzip is working locally

I've a local wamp setup and installed the deflate_module in apache. I've also set up the following rule in .htaccess. <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json </IfModule> But how can I test if ...

Redirecting https to http in Magneto with checkout exception (Apache)

Hey Guys, I am using a Magento installation with the one step checkout plugin meanning I have very few pages that need https, I want to control https search indexing and user access by redirecting the whole https version of the site except of course for the secure checkout. the secure checkout section is /onestepcheckout/ (and also inc...

Apache protect all paths but whitelist a specific path

Below is my VHost (which is slightly modified to obscure some URLS): 1 NameVirtualHost 192.168.1.49:80 2 3 <VirtualHost 192.168.1.49:80> 4 ServerName internal-name.local 5 ServerAlias *.internal-name.local external-domain.co.uk *.external-domain.co.uk 6 7 <Directory "/var/www/html"> 8 AllowOverride All 9 10...

.htaccess make folder act as root?

Hi, Is there a way to make .htaccess tell a folder to act as the lowest level? What I mean is this, say you have a folder like so: /about/ /contact/ /css/ /images/ .htaccess index.php header.php If they are at /contact/index.php, then if I have <a href="../index.php">Home</a> to go to the home page, it works all fine, but if they a...

htaccess redirect all pages to single page

Hi I want to redirect all of my old domain request to my new domain using htaccess file. Below is what I am using but it does not work if the page is not on the new site. For example google index about.htm on the old site but on the new site it does not exist. I would like it to just go to the root in all cases. I know this is not idea...

mod_python with multiple django projects

I tried to configure my django project on a shared hosting (which supports mod_python). Following the procedures, i did make it with their proposed folder structure in the end: [folder structure] /.. /MYAPP /public_html .htaccess in .htaccess PythonPath "['/home/MYACCOUNT/' ] + sys.path" SetHandler python-program Py...

Filename when downloading APK on Android

When I download a file on my Android phone from my webserver it save it as downloadfile.apk The file is saved on my server as MyApp.apk Do you know how to make the file appear as MyApp.apk in the downloaded files list on Android? I should also mention that to get the file to download and be understood by the phone I modified the ....

Htaccess redirect question

Hey all, I have a site I've written in php. The addresses are as follows: http://www.site.com/page.php I'd like any request to: www.site.com/page.php or www.site.com/page To go to: www.site.com/page/ (And force a www.) Can anyone help me? ...

htaccess 301 redirect problem wordpress

I'm trying to move one website to wordpress and I want to redirect a few pages to the new address. I've added the following lines in htaccess and the redirection does not work as I want. Instead of opening http://domain.com/category/category1/ it opens http://domain.com/?option=com_content&amp;task=blogcategory&amp;id=13&amp;Itemid=26 wh...

HTML file to behave like PHP (how to rewrite file extension)

Hi all, How can I rewrite file extension, so when file have extension html, Apache thinks that is php extension? I need it because I have to install some PHP application, which contains HTML files with PHP code in it... Tryed with .htaccess: RewriteEngine On RewriteBase / RewriteRule ^(.*).html$ $1.php [R=301] ... but no luck. Th...

PHP function mysql_connect() does not work if file extension is rewritten from html to php

I have html file with php code in it. It contains code to connect to mysql database. When i run it, it returns me an error: Fatal error: Call to undefined function: mysql_connect() Everything works fine if file extension is php. Also, just to mention that using .htaccess I have rewritten file extension. Also some functions, like ...