.htaccess that allows access via domain and temporary url

CLOSED

.htaccess that allows access via domain and temporary url

Postby rubicon » Mon Jan 17, 2011 5:32 pm

I have an .htaccess file problem I am hoping someone can help me with. I'm using hostgator and it is possible to access my website using either of these urls http://www.mydomainname.com or http://gatorXXX.hostgator.com/~rubicon/mydomainname/.

My CMS uses a .htaccess file to channel all pages requests via a single php file (masterpagecontroller.php). Ideally I would like to get my CMS to work when accessing from both urls. This would enable me to test a new version of my website using the (temporary) gator url while the site is still live on another host.

When the domain is hosted on hostgator, without any .htaccess file, I can access the file phpinfo.php fine using both of the above urls.


The following .htaccess file:

RewriteEngine on
RewriteRule !\.(gif|jpg|png|css|swf|xml|flv|mpg|js|bmp|pdf)$ /home/rubicon/public_html/mydomainname/masterpagecontroller.php [NC,L]

works using http://www.mydomainname.com but not if I use http://gatorXXX.hostgator.com/~rubicon/mydomainname/, this gives a 404 error.



If I use this htaccess file:

Options +FollowSymLinks
ErrorDocument 404 /~rubicon/mydomainname/phpinfo.php

And I reference a file that doesn't exist then I get successfully redirected to phpinfo.php using both http://www.mydomainname.com and http://gatorXXX.hostgator.com/~rubicon/mydomainname/.



However, if I use this .htaccess file:

RewriteEngine on
RewriteRule !\.(gif|jpg|png|css|swf|xml|flv|mpg|js|bmp|pdf)$ /~rubicon/mydomainname/masterpagecontroller.php [NC,L]

Using either http://www.mydomainname.com or http://gatorXXX.hostgator.com/~rubicon/mydomainname/ I get a 500 error.


I would greatly appreciate any thoughts here on whether if it is possible to have a single .htaccess file that will work when accessed from both urls. Hopefully I haven't made an obvious mistake!

Aaron
rubicon
 
Posts: 5
Joined: Tue Apr 10, 2007 3:33 pm

Return to New Threads/Problems

Who is online

Users browsing this forum: No registered users and 1 guest

cron