Some URL Rewrite TIP

Check for a key in QUERY_STRING

Uses a RewriteCond Directive to check QUERY_STRING for passkey, if it doesn’t find it it redirects all requests for anything in the /checklogin/ directory to the /checklogin.php script.
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} !passkey
RewriteRule ^/checklogin/(.*)$ /checklogin.php [L]
Removes the QUERY_STRING from the URL

If the QUERY_STRING has any value at all besides blank than the “?” at the end of /checklogin.php?do=testing tells mod_rewrite to remove the QUERY_STRING from checklogin.php and redirect.
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} .
RewriteRule ^login.php /login.php? [L]
Require the www

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.teachseo4u\.info$ [NC]
RewriteRule ^(.*)$ /$1 [R=301,L]
Require no www

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^teachseo4u\.info$ [NC]
RewriteRule ^(.*)$ http://www.teachseo4u.info/$1 [R=301,L]
External Redirect .php files to .html files (SEO)

RewriteRule ^(.*)\.php$ /$1.html [R=301,L]
Internal Redirect .php files to .html files (SEO )

Redirects all files that end in .html to be served from filename.php so it looks like all your pages are .html but really they are .php
RewriteRule ^(.*)\.html$ $1.php [R=301,L]

Leave a Comment

You must be logged in to post a comment.

powered by WordPress - Themes By Phoenixtheme