Web Advertising - Loans - Compare - Western Union - Credit

PDA

View Full Version : Complicated site restructuring and 301's to accompany it - need help!


SupaMonkey
Jan 26th 2008, 12:26 am
Hey guys,
I just finished re-designing my whole site. I used to have subdomains for subsections of my site and I want to do away with that and go to directories.

I used to have:
1) subdomain.whatever.com
2) subdomain.whatever.com/index.php?section=somepage

Now I want to have it redirected
1) www.whatever.com/some_new_folder_name
2) www.whatever.com/some_new_folder_name/1-a_completely_new_page_name.htm


This is what I have - Im really stuck when it comes to (2):
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^hosting.osirion.co.za [NC]
RewriteRule ^(.*)$ http://www.osirion.co.za/web_hosting/ [L,R=301]


Please help! You can also suggest how to fix the above if its un-optimal/wrong :P THANKS!

ilovelinux
Jan 26th 2008, 1:23 am
RedirectPermanent subdomain.whatever.com www.whatever.com/some_new_folder_name

I am not sure with the syntax though.

Just add that similar to your .htaccess.

SupaMonkey
Jan 26th 2008, 2:05 am
Yeah, (1) isnt the problem - (2) is what Im battling with :(

SupaMonkey
Jan 26th 2008, 3:29 am
I can do this for example, but this just uses the same page name - and I dont want that - I want to specify the new page name:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^whatever.osirion.co.za$ [OR]
RewriteCond %{HTTP_HOST} ^www.whatever.osirion.co.za$
RewriteRule ^(.*)$ http://www.osirion.co.za/whatever/ [R=301,L]

Ladadadada
Jan 26th 2008, 7:09 pm
If I understand this correctly, there is no relationship between the old URL and the new URL other than they have the same content. They have completely different names.

The only way to do this is by maintaining a mapping of old URLs to new URLs. This can be done in the .htaccess file but manually placing a rewrite for each and every URL on the old site pointing to the new site or it can be done in a PHP file (that possibly accesses a database to make adding new URLs easier) on the old site that all pages on the old site map to with a catch-all rewrite.
Both methods are roughly the same. One involves a bit more effort up front and less later on, the other requires less effort up front but a little more to maintain.

Either way, you're going to have to list every old URL and every new URL that it should point to.

You might want to re-think the design decision to make new URLs that don't look like the old ones.