301 Redirect from old html pages to new php pages

Post all HTML related questions here. No support.

Moderator: Project members

Locked
Message
Author
karan_sagacious
500 Command not understood
Posts: 1
Joined: 2012-10-22 07:48
First name: Karan
Last name: Sachdev

301 Redirect from old html pages to new php pages

#1 Post by karan_sagacious » 2012-10-22 07:56

Hi,
I really need your help regarding an issue I'm facing with .htaccess file.
I've recently moved my website from html to php. Now, I want to redirect few old html pages to new php pages. The problem is that the file names are different.

Example:
How to redirect: http://www.example.com/Patent_Filing_Support.html#
To
http://www.example.com/services_and_pricing.php

Your help is appreciated. Thanks a lot.

PieterOliehoek
500 Command not understood
Posts: 4
Joined: 2013-09-01 13:59
First name: Pieter
Last name: Oliehoek

Re: 301 Redirect from old html pages to new php pages

#2 Post by PieterOliehoek » 2013-09-01 15:08

I would do it quick an dirty:

Code: Select all

<html><body>
<p><a id="rd" href="http://www.example.com/services_and_pricing.php">Click here !!</a>
<script language="javascript" type="text/javascript">
window.location.href = document.getElementById('rd').href;
</script>
</body>
</html>

User avatar
botg
Site Admin
Posts: 35509
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

Re: 301 Redirect from old html pages to new php pages

#3 Post by botg » 2013-09-01 17:00

mod_redirect :)

halpenny
500 Command not understood
Posts: 1
Joined: 2013-12-11 22:29

Re: 301 Redirect from old html pages to new php pages

#4 Post by halpenny » 2013-12-11 22:40

Put
Redirect /Patent_Filing_Support.html /services_and_pricing.php
into .htaccess

User avatar
Ramesh8248
500 Command not understood
Posts: 2
Joined: 2014-01-22 11:59
First name: Ramesh
Last name: Pardhi

Re: 301 Redirect from old html pages to new php pages

#5 Post by Ramesh8248 » 2014-01-22 12:57

in .htaccess add this code

Code: Select all

Redirect 301 /htmlpage /Yourphppage
For example
I have to redirect http://www.example.com/mypage.html to http://www.example.com/mypage.php

then, add following code to .htaccess file

Code: Select all

Redirect 301 /mypage.html /mypage.php
<Please read forum rules, no commercial links in signatures, posts and profiles!>

Locked