Problem Mortgage - Mortgages - Free Music Download - Hen Night Blackpool - Loans

PDA

View Full Version : redirect in htaccess


hurricane_sh
Oct 22nd 2004, 9:54 am
I changed the file extension of the whole site, is it possible to redirect the old URLs without listing all in htaccess?

For example:
redirect permanent file1.html http://www.domain.com/file1.php
...
redirect permanent file100.html http://www.domain.com/file100.php


Mod_rewrite seems not suitable because I want the Search Engines know the new files.

Thanks!

Solicitors Mortgages
Oct 27th 2004, 7:44 am
Its easier to create a custom 404 page that directs users just back to your home page.
GEM

catasoft
Jun 7th 2006, 2:53 am
But if the page has a high PR, wouldn't that just ruin it?
404 on a PR4 page moves the PR to that page, not the one with the actual information one wants to show.

Xig
Jun 7th 2006, 3:08 am
Mod rewrite and PHP can be useful. For example, using mod rewrite you can redirect all .html URLs to a single PHP script, which using server variables can return a redirect or display a suitable error message:

"This page has been moved to http://domain.com/page.php"

Would that be of use?

mad4
Jun 7th 2006, 3:10 am
But if the page has a high PR, wouldn't that just ruin it?
404 on a PR4 page moves the PR to that page, not the one with the actual information one wants to show.

Quite right, you should redirect to the new page from the old page.

I reckon he probably got it sorted by now though.:rolleyes:

Nintendo
Jun 7th 2006, 3:18 am
Did some one get bumped??!! :D But sine it hasn't been posted yet, and hurricane_sh was last actiave...today...


Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^([^.]+)\.php$ http://www.domain.com/$1.html [R=301,L]

to redirect from .php to.html and the search engines will evenutally update the links and take the PR to the new URL.

Something tells me there was no mod_rewrite/redirect pro here before I came along!! :D:D

Xig
Jun 7th 2006, 3:31 am
RewriteRule ^([^.]+)\.php$ http://www.domain.com/$1.html [R=301,L]

An elegant solution! Thanks Nintendo .. I've learnt something today (even if I am hungover) :D