Remove some keywords from the url

New to mod_rewrite? This is a good place to start.

Remove some keywords from the url

Postby tomoioaga » Tue Jun 16, 2009 3:25 am

Hi,
recently I shortened some extremely long URL's like
www.site.com/some-path-here/some-other- ... /index.php

to
www.site.com/some-path-here/some-other- ... /index.php

unfortunately, some incoming links are now getting 404's
how to fix this?
the number of levels ("/") in the url's vary, the only constant is the "-and-some-nasty-keyword" which should be removed.

Thanks a LOT for the help guys.
tomoioaga
 
Posts: 4
Joined: Mon Feb 02, 2009 3:13 am

Postby richardk » Tue Jun 16, 2009 10:33 am

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(.+/)?[^/]+-and-some-nasty-keyword/((.+/)?index\.php)$ /$1$2 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 104 guests

cron