Forum Moderators: phranque
I am trying to make friendly urls for my website.
Here's what I want:
www.mydomain.com/display_ad.php?id=3 to become
www.mydomain.com/display_ad_3.html
I read some tutorials on modyifing the .htaccess file and here's what I got so far:
AddHandler server-parsed .htm
AddHandler server-parsed .htm
RewriteEngine On
RewriteBase /
RewriteRule ^display_ad_([0-9]+)\.html$ /display_ad.php?id=$1 [L]
And it's not working. Anyone knows where the mistake is?
Thanks
1. I just typed the url in the browser: www.mydomain.com/display_ad_3.html
2. I have an index page where the ads are displayed and I clicked the link in there. The address in the browsers changes to www.mydomain.com/display_ad_3.html
In both situations I get the following error:
Error 404: NOT FOUND!
Your browser cannot find the document corresponding to the URL you typed in
And yes, there is an ad where id=3. If I type www.mydomain.com/display_ad.php?id=3 I get the page with no problems.
I have 2 pages: alice.html and bob.html
Here's the rewrite:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^alice.html$ bob.html
If I go the alice.html I should get the bob.html page right? When I access the alice.html file I get the error:
Error 404: NOT FOUND!
Your browser cannot find the document corresponding to the URL you typed in.
<snip>
I read somewhere that I should make phpinfo() file to see if mod_rewrite is enabled on my server. Here's the file
http://s125410096.example.com/rewrite/info.php
but I don't see anythng related to mod_rewrite. Does that mean it's disabled?
This is very frustrating.
[edited by: jdMorgan at 1:33 pm (utc) on Oct. 10, 2007]
[edit reason] No URLs, please. See TOS. [/edit]
Options +FollowSymLinks +Indexes
RewriteEngine on
#
RewriteRule ^alice\.html$ http://www.google.com/ [R=302,L]
Using mod_rewrite on a server with no access to error logs is frustrating and may cost you hours of extra time every time you add mod_rewrite code that isn't absolutely correct.
Jim