Page 1 of 1
[SOLVED] ErrorDocument Redirection
Posted: Sun Sep 11, 2005 2:30 am
by anjanesh
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
Re: ErrorDocument Redirection
Posted: Sun Sep 11, 2005 2:41 am
by josh
Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^localhost [NC]
ErrorDocument 404 /mysite/index.php
???
Posted: Sun Sep 11, 2005 3:06 am
by anjanesh
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.
Posted: Sun Sep 11, 2005 7:17 am
by feyd
./index.php ?
Posted: Sun Sep 11, 2005 7:26 am
by anjanesh
Displays
./index.php and nothing more - doesnt not load
http://localhost/mysite/index.php - using APache on Widnows BTW.
Posted: Sun Sep 11, 2005 7:31 am
by feyd
use mod_rewrite then for this

Posted: Sun Sep 11, 2005 8:20 am
by anjanesh
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
Posted: Sun Sep 11, 2005 8:43 am
by feyd
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$
Posted: Sun Sep 11, 2005 8:55 am
by anjanesh
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
Posted: Sun Sep 11, 2005 8:56 am
by feyd
different versions of regex support. Those are VERY different servers these days...
Posted: Sun Sep 11, 2005 12:58 pm
by anjanesh
Ah...Thanks.