HTACCESS: Always Redirect Page/URL-Path to other Page
Tip by Stefan Trost | 2014-01-01 at 21:43
Question: As part of restructuring my website I have renamed some pages. Because there are still existing some of my old URLs somewhere on the Internet, I would like to include an automatic redirect in my .htaccess file that redirects, for example, all requests to the URL "example.com/oldpage" to the URL "example.com/newpage" instead.
Answer: This is possible with the following lines in the .htaccess file:
RewriteEngine On RewriteRule ^oldpage http://www.example.com/newpage [R=301,L]
Whenever someone is typing "example.com/oldpage" in his browser, with this redirection, automatically the page "example.com/newpage" is displayed. At the same time the requesting browser is notified with the HTTP status code 301 (Moved Permanently). With this, for instance the Google Bot knows, that you can find the corresponding site under the new URL in future.
About the Author
You can find Software by Stefan Trost on sttmedia.com. Do you need an individual software solution according to your needs? - sttmedia.com/contact
Show Profile
Related Topics
HTACCESS: Simplify URL
Tutorial | 0 Comments
Mouseover buttons using CSS without reloading
Tutorial | 0 Comments
Create URL for Website from Title of Page
Tutorial | 0 Comments
Create Custom Error Pages for Website
Tip | 0 Comments
Reload Images, CSS, JS and Web Pages despite Browser Cache
Tip | 2 Comments
CSS: Include CSS Stylesheets in HTML
Tutorial | 0 Comments
Rename File to its Folder Name
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.