Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 09-05-2008, 11:42 AM   #1
Active Warrior
War Room Member
 
Jason Brown's Avatar
 
Join Date: Nov 2007
Location: UK
Posts: 58
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Contact Info
Send a message via Skype™ to Jason Brown
Default Redirect all html -> php and more..

Warriors,

I am in the middle of changing over to php (at last). I have done some reseach but before I go ahead just wanted to check. I am going to edit the htaccess file with this:

RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php

any comment on this?

The domain is actually an addon domain in hostgator, just checking that this should not matter, I think I just need to create htaccess and put in the root of the addon?

The main domain is also changing:

However a little more complicated

I have also changed from html -> php but ALSO changed a whole bunch of files to another directory.

Now I want to do two things:

1) redirect to php
2) for 20+ pages change the path

Can I therefore use above redirect from html to php, and then I guess I will have to add each page 301 thats changed directory?

eg. ww..home.com/help-me-please.html
to: ww..home.com/articles/help-me-please.php

Also wanted to put in a 404 redirect to a page incase I missed anything, being the main domain how can I say

any 404 from ww..home.com -> new
but not to include any addon domains 404's

Q - do I need a htaccess file then on each addon domain - as I think the current main htaccess covers all domains at the moment?

hope that made sense

Your help is much appreciated

Jason
Jason Brown is offline   Reply With Quote
Old 09-08-2008, 04:14 PM   #2
Active Warrior
War Room Member
 
Jason Brown's Avatar
 
Join Date: Nov 2007
Location: UK
Posts: 58
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Contact Info
Send a message via Skype™ to Jason Brown
Default Re: Redirect all html -> php and more..

Please......

getting paranoid I did not ask the right question. Also nervous about switching over so any comments welcome.

Many Thanks
Jason
Jason Brown is offline   Reply With Quote
Old 09-08-2008, 04:31 PM   #3
HyperActive Warrior
War Room Member
 
rwil02's Avatar
 
Join Date: May 2005
Location: Auckland, New Zealand.
Posts: 241
Thanks: 0
Thanked 13 Times in 12 Posts
Social Networking View Member's Twitter Profile 
Default Re: Redirect all html -> php and more..

I'm REALLY not an HTACCESS expert, but I think you could do the following:

RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php

triggers the first redirect.

Then list the 20 or so pages under that

RedirectMatch 301 ^/mypage1.php$ http://www.example.com/articles/mypage1.php
RedirectMatch 301 ^/mypage2.php$ http://www.example.com/articles/mypage2.php

rwil02 is offline   Reply With Quote
Old 09-08-2008, 05:13 PM   #4
Edwin Boiten
War Room Member
 
edynas's Avatar
 
Join Date: Sep 2006
Location: The Hague,Netherlands.
Posts: 588
Blog Entries: 1
Thanks: 206
Thanked 128 Times in 80 Posts
Contact Info
Send a message via Skype™ to edynas
Default Re: Redirect all html -> php and more..

maybe a silly question...The content you made till now...is there a reason why you switch it to .php because if it's purely because the rest is also I would leave it as is. you can mix .php and .html as much as you want on a site and there is no need to have it match.

But if you do want it for estatic purposes (and not because you are using some sort of templet system now fi) you can also add these lines in the htaccess which will leave your .html on the surface the same but they will be .php files

RewriteEngine on
RewriteRule (.*).html $1.php

I don't like to mess with structure after a site is indexed and rather build futher then to erase and start again. Even with a 301 redirect...it just scares me to do anything like that.

All my products - an overview is at : http://edwinboiten.com
edynas is offline   Reply With Quote
Old 09-09-2008, 06:04 PM   #5
Active Warrior
War Room Member
 
Jason Brown's Avatar
 
Join Date: Nov 2007
Location: UK
Posts: 58
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Contact Info
Send a message via Skype™ to Jason Brown
Default Re: Redirect all html -> php and more..

Thanks for your replys guys.

Its a total overhaul of an old html layout to a new and shiny CSS template - looks 100x better and will definitly help conversion.

Got fed up with editing lots of pages for a small change which PHP will solve.

I'm keeping all the txt the same, adding in some internal linking and a few other changes so should not be too bad.

Thanks again.

If it doesnt work I'll be back asking how to fix

Cheers
Jason Brown is offline   Reply With Quote
Old 09-28-2008, 09:00 AM   #6
HyperActive Warrior
 
Join Date: Oct 2007
Posts: 246
Thanks: 13
Thanked 4 Times in 4 Posts
Social Networking View Member's Twitter Profile 
Default Re: Redirect all html -> php and more..

Hi, you've probably got this sorted but just in case this helps anyone - I've attached a file which includes a .htaccess and a .php file - the htaccess sets the php file as the 404 page and whenever there is a 404 error the php file will check if a page by the same name but with a different file extension exists. It will then redirect so if you forget any redirects this might help.
Attached Files
File Type: zip 404.zip (940 Bytes, 3 views)
ChristianM is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Tags
html, php, redirect

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 09:24 PM.