best domain-wide redirect = htaccess I assume?

3 replies
Hey everyone!

Okay so I am switching from Joomla to WP for one of my sites. I have all kinds of existing links on a temporary website that I do NOT want to lose or go to a 404.

My sitemap has 100's of these links with the folder "something/" in them. I want the redirect to remove it for all URLs and make them all point to the new version without the "something/".

So here's an example of the temp. site URL:

http://www.website.com/something/page/offer.html

must redirect to:

http://www.website.com/page/offer.html

I know this is common problem people face when moving stuff around. I'd like to get a 301 redirect done via htaccess if possible and with a single string to basically just truncate "something/" from all URLs.

I think it's something along the lines of:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

Makes sense?

#assume #domainwide #htaccess #redirect
  • Profile picture of the author cgimaster
    Should work for your needs
    Code:
    RewriteRule ^/(.*)/page/offer.html$ http://www.website.com/page/offer.html [R=301,L]
    if something is always the same you could use it this way too:
    Code:
    RedirectMatch 301 ^/something/page/offer.html$ http://www.website.com/page/offer.html
    {{ DiscussionBoard.errors[7367349].message }}

Trending Topics