468,469 Members | 2,228 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,469 developers. It's quick & easy.

301 Redirect homepage and specific URLs to new site

1
Hi Guys,
I'm trying to create an .htaccess file that not redirects the homepage as well as interior pages to the new site.

Here is what I have been trying to use:

Expand|Select|Wrap|Line Numbers
  1. Options +FollowSymLinks
  2. RewriteEngine on
  3.  
  4. Redirect 301 / https://www.newwebsite.com
  5. Redirect 301 /account https://www.newwebsite.com/customer/account/login
  6.  
The homepage works, but the /account URL doesn't. It gets sent to an error page after trying to visit www.newwebsitecom/account

I have lots of pages that I'm attempting to match up with the new site. Any suggestions on how to do this and map them out? Thanks in advance!
Jan 22 '13 #1
2 6150
Luuk
1,043 Expert 1GB
Your 'Redirect lines are wrong....
The '301' need not be there.
(http://httpd.apache.org/docs/current....html#redirect)

To redirect every page that is not found to home, use:
Expand|Select|Wrap|Line Numbers
  1. ErrorDocument 404 http://www.example.com
Feb 9 '13 #2
Just try this way:

1. Create an empty text file using a text editor such as notepad, and save it as htaccess.txt.

NOTE:
The reason you should save the file as htaccess.txt is because many operating systems and FTP applications are unable to read or view .htaccess files by default. Once uploaded to the server you can rename the file to .htaccess.
2. Edit the contents of the file. Check the following examples:

301 (Permanent) Redirect: Point an entire site to a different URL on a permanent basis. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the "mt-example.com" domain:

# This allows you to redirect your entire website to any other domain
Redirect 301 / http://mt-example.com/

302 (Temporary) Redirect: Point an entire site to a different temporary URL. This is useful for SEO purposes when you have a temporary landing page and plan to switch back to your main landing page at a later date:

# This allows you to redirect your entire website to any other domain
Redirect 302 / http://mt-example.com/

Redirect index.html to a specific subfolder:

# This allows you to redirect index.html to a specific subfolder
Redirect /index.html http://example.com/newdirectory/

Redirect an old file to a new file path:

# Redirect old file path to new file path
Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html
Redirect to a specific index page:

# Provide Specific Index Page (Set the default handler)
DirectoryIndex index.html
Jun 13 '14 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by EDOnLine | last post: by
1 post views Thread by giodo | last post: by
5 posts views Thread by Seb | last post: by
4 posts views Thread by Mike Gleason jr Couturier | last post: by
1 post views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.