Quick reference to create URL rewrites in .htaccess

If you just want to redirect an individual page, set the rewrite rules below by replacing “page1” with the page your want to redirect to, in this case it is “new-page1”. The “page1” on the left can be COMPLETELY DIFFERENT than the destination file, by the way!

Do you see the pattern? Notice the (.*) wildcard, which represents a section of the page URL that can contain any characters as long as it is AFTER “page1” and the “$1” at the end of the new destination URL is the correlating reference to this wildcard text which essentially just carries the contents of text within this wildcard to its new place in the new URL on the right. Confused yet?!

RewriteEngine On
RewriteRule ^page1(.*) http://%{SERVER_NAME}/new-page1$1 [R,L]

About Author:

Senior Cloud Software Engineer and 25+ years experienced video production, video editing and 3D animation services for a variety of global clients including local video production here in Jacksonville, Florida.

Leave a Comment

Your email address will not be published. Required fields are marked *