![]() | | ||||||||
| | #1 |
| HyperActive Warrior War Room Member Join Date: Feb 2004 Location: , , United Kingdom.
Posts: 451
Thanks: 21
Thanked 47 Times in 39 Posts
|
Have rebuilt a website that previously had .php extensions, the new site uses wordpress and the page names are for example domain.com/newpage/ the domain name has been retained. Is it possible to redirect a visitor who tries to access say domain.com/contact.php to domain.com/contact-us/ Have tried a few routes using the htaccess file but can't seem to get it to work. cheers Tony |
| | |
| | #2 |
| Keyboard Warrior Join Date: Apr 2008 Location: , , USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
Did you try stripping all of the code from the old php page (including any html) and inserting <?php header( 'Location: [insert new url here]' ) ; ?> You have to do it with a completely blank page... let me know if it works! |
| | |
| | #3 |
| HyperActive Warrior War Room Member Join Date: Feb 2004 Location: , , United Kingdom.
Posts: 451
Thanks: 21
Thanked 47 Times in 39 Posts
|
Hi, thanks for that, might come in useful sometime, but for now, the old pages no longer exist. Tony |
| | |
| | #4 |
| Keyboard Warrior Join Date: Apr 2008 Location: , , USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
Well, you could create a new old page at domain.com/contact.php for the redirect (that's how I tested my response), or did I miss something?
|
| | |
| | #5 |
| HyperActive Warrior War Room Member Join Date: Oct 2007 Location: Mission, TX, USA.
Posts: 333
Thanks: 224
Thanked 62 Times in 36 Posts
|
You can edit your .htaccess file. Put this line in there: Code: Redirect /contact.php http://domain.com/contact-us/ |
|
~Dave
| |
| | |
| | #6 |
| HyperActive Warrior War Room Member Join Date: Feb 2004 Location: , , United Kingdom.
Posts: 451
Thanks: 21
Thanked 47 Times in 39 Posts
| |
| | |
| | #7 |
| Web Developer Join Date: Nov 2008 Location: Asheville, NC USA
Posts: 420
Thanks: 18
Thanked 57 Times in 51 Posts
|
I recommend you use a 301 response code in addition to the redirect. In .htaccess the above would look like: Code: Redirect 301 /contact.php http://domain.com/contact-us/ |
| Wayfarer | join me on StoryBlorg | |
| | |
![]() |
|
| Tags |
| redirects |
| Thread Tools | |
| |
![]() |