Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can !
Moderator: General Moderators
anjanesh
DevNet Resident
Posts: 1679 Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India
Post
by anjanesh » Sun Sep 11, 2005 2:30 am
http://localhost/mysite
In mysite's .htaccess I have
Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^localhost [NC]
ErrorDocument 404 index.php
But instead of going to index.php it just outputs index.php
If I replace
ErrorDocument 404 index.php with
ErrorDocument 404 /index.php it shows
http://localhost/index.php and not
http://localhost/mysite/index.php
Any idea how to fix this ?
Thanks
Last edited by
anjanesh on Sun Sep 11, 2005 12:58 pm, edited 1 time in total.
josh
DevNet Master
Posts: 4872 Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida
Post
by josh » Sun Sep 11, 2005 2:41 am
Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^localhost [NC]
ErrorDocument 404 /mysite/index.php
???
anjanesh
DevNet Resident
Posts: 1679 Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India
Post
by anjanesh » Sun Sep 11, 2005 3:06 am
I want to give the relative path, index.php in mysite directory not ErrorDocument 404 /mysite/index.php after all the .htaccess file is in mysite directory.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Sep 11, 2005 7:17 am
./index.php ?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Sep 11, 2005 7:31 am
use mod_rewrite then for this
anjanesh
DevNet Resident
Posts: 1679 Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India
Post
by anjanesh » Sun Sep 11, 2005 8:20 am
On my localhost this works (
http://localhost/myfolder/a.html )
Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^localhost
RewriteRule ^([\w\d\-]+)\.html$ index.php?a=$1
But when copied to my site with a few changes it doesnt - returns 404 (
http://www.mysite.com/myfolder/a.html )
Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule ^([\w\d\-]+)\.html$ index.php?a=$1
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Sep 11, 2005 8:43 am
rewrite condition wasn't met. You're looking for mysite.com at the beginning of the value. If you want to support subdomains, it must be more like mysite\.com$
anjanesh
DevNet Resident
Posts: 1679 Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India
Post
by anjanesh » Sun Sep 11, 2005 8:55 am
Not a subdomain.
I replaced \w\d\- with a-zA-Z0-9\- and it worked !
I dont understand why \w\d\- works on my localhost and not on site !
My PC : Apache 2.0.52
Site : Apache 1.3.33
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Sep 11, 2005 8:56 am
different versions of regex support. Those are VERY different servers these days...
anjanesh
DevNet Resident
Posts: 1679 Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India
Post
by anjanesh » Sun Sep 11, 2005 12:58 pm
Ah...Thanks.