gopibabus
1/19/2018 - 10:01 AM

Sample .htaccess file

This is sample .htaccess file to define custom routing

# Turn Rewrite Engine On
RewriteEngine on

# Rewrite for subjects.php
RewriteRule ^custom$ subjects.php [NC,L]

# NC makes the rule non case sensitive
# L makes this the last rule that this specific condition will match
# $ in the regular expression makes the matching stop so that "custom123!" will not work

# Rewrite for admin.php?user=xxxxx
RewriteRule ^admin/([0-9a-zA-Z]+)$ admin.php?user=$1 [NC,L]

# Rewrite for book.php?id=1&title=title-of-book
RewriteRule ^book/([0-9]+)/([0-9a-zA-Z_-]+)$ book.php?id=$1&title=$2 [NC,L]