473,396 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 6396
Luuk
1,047 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

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

Similar topics

2
by: Ron Howard | last post by:
I am trying to use the following in an ASP page to redirect a user to a non-anonymous FTP site: response.redirect("ftp://myusername:mypassword@ftp.mysite.com") but I keep getting a "permission...
4
by: EDOnLine | last post by:
We have a page which, after inserting a record ID to our database via stored proceedure, redirects the user to a URL on a thrid party site which as passed to that page via QueryString. In other...
1
by: briain | last post by:
Hi, I am just wondering if anyone knew is it possible to response.redirect to a specific line in another page? - much like you can do in html? If it helps - i am using visual studio 2005 ...
1
by: briain | last post by:
Hi, I am just wondering if anyone knew is it possible to response.redirect to a specific line in another page? - much like you can do in html? If it helps - i am using visual studio 2005 ...
1
by: giodo | last post by:
Hi ALL When we try to get an access to a secure content in a IIS with "Basic Authentication" IE shows a dialog box to set user ID and pass. After correct authentication IE (all browsers) adds a...
5
by: Seb | last post by:
Hi, We have a page in VB.NET redirecting to an external site. Example: http://mysite.com/redirect.aspx?url=http//externalsite.com/their-page.asp The target page on the external site...
1
by: webandwe | last post by:
Hi, Is there a code I can use to redirect a user on a cell phone from one page to another. Basically what I want to do is if a user comes to my website on a cell phone I want to re-direct him...
0
by: peanutgnome | last post by:
Folks, looking for a little guidance on an .htaccess redirect problem - I'm a bit of a newbie when it comes to the rewriting of urls... We've changed from one CMS to another on our company...
4
by: Mike Gleason jr Couturier | last post by:
Hi, What's a clean way to redirect users on an information page while doing site maintenance... Can we do it with urlMappings !? (wildcard "*"?) Thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.