Loading

Htaccess Redirect From one page another

Htaccess Redirect From one page another

Learn how to redirect page using Redirect, RedirectMatch and RewriteRule directives.

Applicable for Apache based web applications

Redirect from one page to another page

To redirect one page (say page1) to another page (say page2), add the following code your htaccess file

#simple redirect using Redirect directive
Redirect /page1.html /page2.html

#using RedirectMatch Directive
RewriteEngine On
RedirectMatch "^/page1$" "/page2"

#using RewriteRule directive - works only for root pages, so adding '/' will not work here
RewriteEngine On
RewriteRule "^page1$" "/page2" [R]

Drop a comment if this code not working for you.

5 2 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x