Welcome! Log In Create A New Profile


Php My Directory rewrite rules

Posted by akia 
Php My Directory rewrite rules
May 29, 2012 03:57PM
Hi All,

Can someone help me in rewriting the .htaccess rules for php my directory to the nginx format.

#Options +FollowSymLinks
#Options -MultiViews
#Options All -Indexes

# This can be uncommented to compress js and css files
#<IfModule mod_deflate.c>
#<FilesMatch "\.(js|css)$">
# SetOutputFilter DEFLATE

# This can be uncommented to set cache control for image, js, and css files
#Header unset ETag
#FileETag None
#<FilesMatch "(?i)^.*\.(ico|flv|swf|jpg|jpeg|png|gif|js|css)$">
#Header unset Last-Modified
#Header set Expires "Fri, 21 Dec 2012 00:00:00 GMT"
#Header set Cache-Control "public, no-transform"

<FilesMatch "\.(htaccess|tpl)$">
Order Allow,Deny
Deny from all

<IfModule mod_rewrite.c>
RewriteEngine On

#RewriteRule ^([a-zA-Z]+)\.html$ $1.php [L]

#Handle all category links. Static category text followed by ID, followed by path
#The "category" text here needs to be changed if the language variable category is changed
RewriteRule ^category\/(.+/)location/(.+)$ browse_categories.php?id=$1&location=$2 [L,NC,QSA]
RewriteRule ^category\/(.+)$ browse_categories.php?id=$1 [L,NC,QSA]

#Handle all location links. Static location text followed by ID, followed by path
#The "location" text here needs to be changed if the language variable location is changed
RewriteRule ^location\/(.+)$ browse_locations.php?id=$1 [L,NC,QSA]

#Rewrite pages
RewriteRule ^pages\/(.+)\.html$ page.php?id=$1 [L,NC]

#Rewrite Blog
RewriteRule ^blog.html$ blog.php [L,NC,QSA]
RewriteRule ^blog\/([^/]+)-([0-9]+).html$ blog_post.php?id=$2 [L,NC]
RewriteRule ^blog\/category\/(.+)-([0-9]+).html$ blog.php?category_id=$2 [L,NC,QSA]

#Rewrite listing/banner website out
RewriteRule ^out-([0-9]+)\.html$ out.php?listing_id=$1 [L]
RewriteRule ^out-([0-9]+)-([0-9]+)\.html$ out.php?listing_id=$1&banner_id=$2 [L]

#Rewrite listings
#Ignore any physical files
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)\.html$ listing.php?id=$1 [L,NC]
RewriteRule ^([^/]+)/images\.html$ listing_images.php?id=$1 [L,NC]
RewriteRule ^([^/]+)/send-message\.html$ listing_email.php?id=$1 [L,NC]
RewriteRule ^([^/]+)/send-message-friend\.html$ listing_email_friend.php?id=$1 [L,NC]
RewriteRule ^([^/]+)/reviews\.html$ listing_reviews.php?id=$1 [L,NC,QSA]
RewriteRule ^([^/]+)/add-review\.html$ listing_reviews_add.php?id=$1 [L,NC]
RewriteRule ^([^/]+)/classifieds\.html$ listing_classifieds.php?id=$1 [L,NC,QSA]
RewriteRule ^([^/]+)/documents\.html$ listing_documents.php?id=$1 [L,NC,QSA]
RewriteRule ^([^/]+)/suggestion\.html$ listing_suggestion.php?id=$1 [L,NC]
RewriteRule ^([^/]+)/claim\.html$ listing_claim.php?id=$1 [L,NC]

#Rewrite classifieds
RewriteRule ^classified/[^/]+-([0-9]+)\.html$ classified.php?id=$1 [L,NC]
RewriteRule ^classified/[^/]+-([0-9]+)/images\.html$ classified_images.php?id=$1 [L,NC]

#Rewrite sitemap
RewriteRule ^sitemap.xml$ xml.php?type=sitemap [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ 404.php?id=$1 [L,NC]

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 118
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready