URL re-writing : Tips for .htaccess file

URL re-writing : Tips for .htaccess file

URL re-writing : Tips for .htaccess file

.htaccess

***** Rewrite folder name to a filename *****
Admin url is folder/cms-admin/index.php and access should be folder/admin

***** All requests to page.html will be sent to page.php *****
This will rewrite any filename with .html to .php

[NC] means “No Case Sensitive”;

***** All files of .html to .php *****

***** Rewrite www to non www url *****

***** Rewrite non www to www *****

***** Rewrite non www to www with https *****
All non www url will be re-written to www with prefix https

***** Redirect http to https on one page only *****

***** Rewrite file links *****

Final result:
site.com/files/foo.zip

***** Rewrite http to https for only one folder *****

Lucas Callado

Lucas Callado

Full stack developer, architect and a technical lead in the field of web engineering.
Lucas Callado

Leave a Reply

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

fifteen + nine =