.htaccess tutorial

htaccess Elite


simple redirect question

Ask your mod_rewrite and Redirection questions here, and get answers!

simple redirect question

New postby m055ad » 08 Jan 2008 22:12

hello guys this is my FP here :)

I think my problem is simple but since I'm a mod_rewrite n00b I need some help.

I already made some rewrites and now I have some links that look like:

site.com/news/index.html - this is the link that is already indexed by search engines and I want to keep it, it's the good one.

But, I also have links that look like:
Code: Select all
- www.site.com/news/index.php
- www.site.com/news/


All these links point to the same page, http://www.site.com/news/index.html.

These links are bad and I want to redirect them to the good one, and although I've read rewrite guides all this day, I didn't find a solution.
Please help.

Thanks.
m055ad
 
Posts: 1
Joined: 08 Jan 2008 22:03

New postby htaccess » 17 Jan 2008 03:21

A common problem, no doubt. See if this works.

Code: Select all
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/news/index\.php$ [OR]
RewriteCond %{REQUEST_URI} ^/news/$
RewriteRule .+ http://www.site.com/news/index.html [R=301,L]
htaccess
 
Posts: 50
Joined: 28 Feb 2007 17:16


Return to Redirect or Rewrite Questions