Page 1 of 1
Rewrite not working
Posted: Wed Mar 26, 2008 5:40 pm
by waradmin
I have the following htaccess file:
Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)/(.*)/(.*)/(.*)/$ /index.php?$1=$2&$3=$4
Designed to take a URL like:
Code: Select all
http://www.mydomain.tld/index.php?page=members&do=inbox
and make it like:
Code: Select all
http://www.mydomain.tld/page/members/do/inbox/
However it is just throwing me a 404 error. I am using Apache2Triad on a Windows development dummy server. Any ideas?
Re: Rewrite not working
Posted: Wed Mar 26, 2008 5:45 pm
by hawleyjr
This is probably because you are using a Windows server.
Windows thinks that .htaccess is not a valid filename because it has no name, just an extension. There are work arounds for using windows and .htaccess try a search for "htaccess windows"
Re: Rewrite not working
Posted: Wed Mar 26, 2008 5:46 pm
by waradmin
In any rate, I get the same result on my Unix server.
Re: Rewrite not working
Posted: Wed Mar 26, 2008 6:00 pm
by waradmin
Update: I got it semi working. Is there a way to make the URL not require all the parts (note the updated htaccess looks like this):
Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)/(.*)/(.*)/$ index.php?page=$1&$2=$3
For example, when I try to go to
http://www.example.tld/members/ I get a 404, however when I go to
http://www.example.tld/members/do/inbox/ it works (semi works, images are broken so I need to find a way to fix that too). Any ideas on this fix?