mod_rewrite help

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
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

mod_rewrite help

Post by malcolmboston »

Im currently having some serious problems with mod_rewrite or maybe im just not understanding it right.....

Code: Select all

 
Rewriterule '^mens/item/(.*)/(.*)/(.*)/(.*) mens-item-(.*)-(.*)-(.*)-(.*).html [R=301, NC, L]
 
Ive added this line to my mod_rewrite file but i get an internal server error when its turned on.

basically i want this page:
http://www.redsquareclothing.co.uk/mens ... jma-Jacket
to automatically redirect using a 301 to this page:
http://www.redsquareclothing.co.uk/mens ... acket.html

Any help or nod in the right direction would be much appreciated.

edit: :? @ shortened URL

Regards, Mal
j4IzbInao
Forum Newbie
Posts: 9
Joined: Tue Oct 14, 2008 6:07 am

Re: mod_rewrite help

Post by j4IzbInao »

Code: Select all

Rewriterule ^mens/item/(.*)/(.*)/(.*)/(.*)$ mens-item-($1)-($2)-($3)-($4).html [R=301, NC, L]
Should do the trick.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: mod_rewrite help

Post by pickle »

j4IzbInao wrote:

Code: Select all

Rewriterule ^mens/item/(.*)/(.*)/(.*)/(.*)$ mens-item-($1)-($2)-($3)-($4).html [R=301, NC, L]
Should do the trick.
Close, but that'll put parentheses in the forwarded URL.

Code: Select all

Rewriterule ^mens/item/(.*)/(.*)/(.*)/(.*)$ mens-item-$1-$2-$3-$4.html [R=301, NC, L]
should do it.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply