Rewrite not working

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

Post Reply
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Rewrite not working

Post 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?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Re: Rewrite not working

Post 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"
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Re: Rewrite not working

Post by waradmin »

In any rate, I get the same result on my Unix server.
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Re: Rewrite not working

Post 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?
Post Reply