RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

#Remove the .php extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.PHP -f
RewriteRule ^(.*)$ $1.php
# Blog details
RewriteRule ^blog-details/([a-zA-Z0-9-_]+) blog-details.php?bd_id=$1

# Contact page
RewriteRule ^contact-us$1 contact-us.php [L,QSA]

# Index page (homepage)
RewriteRule ^index$1 index.php [L,QSA]

# all_listings_everyone page
RewriteRule ^all_listings_everyone$1 all_listings_everyone.php [L,QSA]

# about page 
RewriteRule ^about$1 about.php [L,QSA]

# all_listings_everyone page 
RewriteRule ^all_listings_everyone$1 all_listings_everyone.php [L,QSA]

# Blog details
RewriteRule ^listing-details/([a-zA-Z0-9-_]+) listing-details.php?detail_page_id=$1

# -----------------------------
# Blog comment submit action
# example: blog_details_review_action
# -----------------------------
RewriteRule ^blog_details_review_action/?$ blog_details_review_action.php [L,QSA]


# Login page
RewriteRule ^login/?$ login.php [L,QSA]

# dashboard page
RewriteRule ^dashboard/?$ dashboard.php [L,QSA]

# add-listing page
RewriteRule ^add-listing/?$ add-listing.php [L,QSA]

# subcription_form page
RewriteRule ^subcription_form/?$ subcription_form.php [L,QSA]

# -----------------------------
# subscription_action 
# example: subscription_action
# -----------------------------
RewriteRule ^subscription_action/?$ subscription_action.php [L,QSA]

# subcription_form page
RewriteRule ^blog-list-sidebar/?$ blog-list-sidebar.php [L,QSA]

# add-listing page
RewriteRule ^add-listing/?$ add-listing.php [L,QSA]

# logout page
RewriteRule ^logout/?$ logout.php [L,QSA]

# -----------------------------
# listing_details_review_action 
# example: listing_details_review_action
# -----------------------------
RewriteRule ^listing_details_review_action/?$ listing_details_review_action.php [L,QSA]

# add-reply page
RewriteRule ^add-reply/?$ add-reply.php [L,QSA]

# add-reply page
RewriteRule ^session_timeout/?$ session_timeout.php [L,QSA]

# Listings by tag (ONLY ONE RULE)
RewriteRule ^listings_by_tag_list/([^/]+)/?$ listings_by_tag_list.php?tag_wish_list_name=$1 [L,QSA]


# Test rewrite
RewriteRule ^test$ test.php [L]

