Forum Moderators: phranque
Options -Indexes
Options +FollowSymLinks
#Rewrite engine
RewriteEngine on
RewriteRule ^product/(\w+)/([0-9]+)$ /index.php?product=$1&pid=$2&sp=1 [edited by: lucy24 at 11:42 am (utc) on Jan 26, 2012]
But this is obviously wrong also what should it be?
"/Images/bleh.jpg"
"/Images/bleh2.jpg"
"/Something/Images/Bleh.jpg"
"/Inc/CSS/Styles.css"
Is this what you mean?
Options -Indexes
Options +FollowSymLinks
#Rewrite engine
RewriteEngine on
#BLOCK ANY PHP REQUESTS
#RewriteRule ^(.*)\.php errors/404
#End
#REDIRECT ANY PHP REQUEST TO HTM
RewriteRule ^(.*)\.htm$ $1.php [nc]
#End
#Main Pages
RewriteRule ^page/([-0-9a-zA-Z_]+)/([0-9]+)$ Pages/$1.php?pid=$2
RewriteRule ^content/([-0-9a-zA-Z_]+)$ index.php?pg=$1
RewriteRule ^content/([-0-9a-zA-Z_]+)/([0-9]+)$ index.php?pg=$1&toe=$2
RewriteRule ^content/contact_gbforklifts/([0-9]+)/([0-9]+)/([0-9]+)$ index.php?pg=contact_gbforklifts&toe=$2&pid=$1&buy=$3
#News Articles
RewriteRule ^news/([-0-9a-zA-Z_]+)/([0-9]+)$ index.php?pg=news&article=$1&nid=$2
#Shop
RewriteRule ^categories/([-0-9a-zA-Z_]+)/([0-9]+)$ index.php?cat=$1&cid=$2
RewriteRule ^categories/([-0-9a-zA-Z_]+)/([0-9]+)/([0-9]+)$ index.php?subcat=$1&scl=$2&cid=$3&child=2
RewriteRule ^categories/subcat/([-0-9a-zA-Z_]+)/([0-9]+)$ index.php?subcat=$1&cid=$2&spl=1
RewriteRule ^products/([-0-9a-zA-Z_]+)/([0-9]+)$ index.php?product=$1&pid=$2&sp=1
#End
#Create 404 Error Page
RewriteRule ^errors/([0-9]+)$ index.php?pg=error&type=$1
#End
#AddType application/x-httpd-php .htm .html
#ErrorDocument 404 /404.php
#End
#Forward sitemap
RewriteRule sitemap\.xml site-map.php [L]
#End
#REDIRECT ANY PHP REQUEST TO HTM
RewriteRule ^([a-z0-9])\.htm$ /$1.php [NC,L]
#End RewriteRule ^categories/([-0-9a-zA-Z_]+)/([0-9]+)$ ...
RewriteRule ^categories/([-0-9a-zA-Z_]+)/([0-9]+)/([0-9]+)$ ...
RewriteRule ^categories/subcat/([-0-9a-zA-Z_]+)/([0-9]+)$ ... example.com/categories/subcat/<something> will have to be trial-matched against the first and second rule before the real match is found in rule 3. I have been trying to develop my .htaccess further into blocking php files and forwarding any htm files to php