Mod_Rewrite URL Help

Discuss practical ways rearrange URLs using mod_rewrite.

Mod_Rewrite URL Help

Postby gamerfm_max » Mon Aug 18, 2008 5:13 am

Hello ive recently got mod_rewrite working and i need a little bit more help with it.

one of my URL's is: www.gamerfm.co.uk/listen.html

i want to make it www.gamerfm.co.uk/listen

without the .html

i have seen this been done with another website

Here is my current Code:

RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*)\.html$ /?id=$1 [L]

i have tryed removing .html$ and \.html$

if you could help , that would be great

Max
gamerfm_max
 
Posts: 3
Joined: Mon Aug 18, 2008 5:10 am

Postby TeckniX » Mon Aug 18, 2008 8:46 am

From what i could tell, you're simply trying to make

http://www.gamerfm.co.uk/listen
go to:
http://www.gamerfm.co.uk/listen.html

Is this correct?

then try:

Code: Select all
Options +FollowSymLinks

RewriteEngine on
RewriteRule ^([a-z0-9]+)$ /$1\.html [NC,L]


TeckniX
 
Posts: 38
Joined: Tue Mar 27, 2007 12:18 pm

Postby gamerfm_max » Mon Aug 18, 2008 10:00 am

what im trying to do is make the mod rewrite change index.php?id=schedule to /schedule (http://gamerfm.co.uk/schedule)
gamerfm_max
 
Posts: 3
Joined: Mon Aug 18, 2008 5:10 am

Postby richardk » Mon Aug 18, 2008 4:57 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^/]+)/?$ /?id=$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby gamerfm_max » Mon Aug 18, 2008 10:35 pm

Worked , Cheers
gamerfm_max
 
Posts: 3
Joined: Mon Aug 18, 2008 5:10 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 38 guests

cron