Reputation: 113
I have copy and pasted the new index.html file I made into the old one. However, I need to now redirect users from the old .html files to the new index page which has anchor links. I have seen 301 redirects online but none of the examples included items that were in the same folder on the same domain. I tried to use the following, in a .htaccess file, but it didn't work.
//301 Redirect Old File
Redirect 301 /about_us.html #AboutUs
Redirect 301 /contact_us.html #GetQuote
Thanks in advance!
Upvotes: 0
Views: 44
Reputation: 1111
You may need to redirect people to a different page because a URL has changed. Redirect to a Different URL using the Meta Tag "Refresh".
<meta http-equiv="refresh" content="0;URL=http://www.example.com/new-index.html">
You can change the amount of time that this redirecting page is displayed by changing the number in the refresh content="5 portion of the meta tag statement.
<meta http-equiv="refresh" content="5;URL=http://www.example.com/new-index.html">
Note that meta tags go in the
<HEAD> </HEAD>
section of the HTML document.
You can also use this line of code Apache .htaccess redirect.
# Permanent URL redirect
Redirect 301 /web/old-index.html http://www.example.com/web/new-index.html
Hope this will help to resolve your issue !!
Upvotes: 0
Reputation: 9007
You simply need to prepend the target paths with a leading slash:
Redirect 301 /about_us.html /#AboutUs
This will redirect /about_us.html
to /#AboutUs
.
If you omit the leading slash, then Apache will mistake the target path for a comment, and throw an Internal Server Error.
Upvotes: 1