Jump to content

Help need for .htaccess code


rishibala143

Recommended Posts

Hi

 

I am using this .htaccess code for my project. This is working correctly.

 

I am very new in to this. I got some reference from websites and developed this .htaccess code.

 

I have seen in some sites, they use only very minimal code for seo friendly url. But mine looks very long.

 

Is there any way to reduce this code. Kindly help me by giving me some examples. I surfed in web, but i didn't get what i want.

 

Kindly help !!!

 

 

#set link auto on

Options +FollowSymLinks -MultiViews

DirectoryIndex index.php

DirectoryIndex index.html

Options -Indexes

 

RewriteEngine on

RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/

RewriteRule ^index\.php$ http://www.yourdomain.com/ [R=301,L]

RewriteCond %{HTTP_HOST} !^(.*)\.yourdomain\.com$ [NC]

RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]

 

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$

RewriteRule (.*)$ http://www.yourdomain.com/$1/ [R=301,L]

 

RewriteRule ^about-us/$ about-us.php [L]

RewriteRule ^customer-services/$ customer-services.php [L]

RewriteRule ^contact-us/$ contact-us.php [L]

RewriteRule ^terms-conditions/$ terms-conditions.php [L]

RewriteRule ^privacy-policy/$ privacy-policy.php [L]

RewriteRule ^brands/$ brands.php [L]

 

RewriteRule ^products/$ products.php [L]

RewriteRule ^shopping-cart/$ cart.php [L]

 

RewriteRule ^new-products/$ products.php [L]

RewriteRule ^popular-products/$ popular-products.php [L]

RewriteRule ^best-deals/$ best-deals.php [L]

RewriteRule ^product-search/$ product-search.php [L]

RewriteRule ^product-advanced-search/$ asearch.php [L]

RewriteRule ^keyword-search/$ keyword-search.php [L]

RewriteRule ^advanced-search/$ advancedsearch.php [L]

 

RewriteRule ^register/$ register.php [L]

RewriteRule ^login/$ login.php [L]

RewriteRule ^reseller/$ reseller.php [L]

RewriteRule ^logout/$ logout.php [L]

RewriteRule ^forgot-password/$ forgot-password.php [L]

 

RewriteRule ^my-account/$ myaccount.php [L]

RewriteRule ^my-profile/$ myprofile.php [L]

RewriteRule ^change-password/$ changepassword.php [L]

RewriteRule ^wishlist/$ wishlist.php [L]

RewriteRule ^pro-order/$ pro-order.php [L]

RewriteRule ^col-order/$ col-order.php [L]

RewriteRule ^can-order/$ can-order.php [L]

RewriteRule ^dis-order/$ dis-order.php [L]

 

RewriteRule ^imageviewer/([^/]*)\/$ imageviewer.php?pid=$1 [L]

 

RewriteRule ^products/([^/]*)/([^/]*)\/$ main-category.php?ml_id=$1&ml_name=$2 [L]

 

RewriteRule ^products/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\/$ main-category.php?ml_id=$1&ml_name=$2&sortby=$3&ordby=$4&page=$5 [L]

 

RewriteRule ^products/([^/]*)/([^/]*)/([^/]*)/([^/]*)\/$ sub-category.php?ml_id=$1&ml_name=$2&sl_id=$3&sl_name=$4 [L]

 

RewriteRule ^products/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\/$ sub-category.php?ml_id=$1&ml_name=$2&sl_id=$3&sl_name=$4&sortby=$5&ordby=$6&page=$7 [L]

 

RewriteRule ^products/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\/$ sub-sub-category.php?ml_id=$1&ml_name=$2&sl_id=$3&sl_name=$4&ssl_id=$5&ssl_name=$6 [L]

 

RewriteRule ^products/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\/$ sub-sub-category.php?ml_id=$1&ml_name=$2&sl_id=$3&sl_name=$4&ssl_id=$5&ssl_name=$6&sortby=$7&ordby=$8&page=$9 [L]

 

RewriteRule ^products/([^/]*)/([^/]*)/([^/]*)\/$ products.php?sortby=$1&ordby=$2&page=$3 [L]

 

RewriteRule ^new-products/([^/]*)/([^/]*)/([^/]*)\/$ products.php?sortby=$1&ordby=$2&page=$3 [L]

RewriteRule ^popular-products/([^/]*)/([^/]*)/([^/]*)\/$ popular-products.php?sortby=$1&ordby=$2&page=$3 [L]

RewriteRule ^best-deals/([^/]*)/([^/]*)/([^/]*)\/$ best-deals.php?sortby=$1&ordby=$2&page=$3 [L]

 

 

RewriteRule ^product-search/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\/$ product-search.php?sea_mlid=$1&sea_slid=$2&sea_sslid=$3&sea_brandid=$4&sea_min_price=$5&sea_max_price=$6 [L]

 

RewriteRule ^product-search/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\/$ product-search.php?sea_mlid=$1&sea_slid=$2&sea_sslid=$3&sea_brandid=$4&sea_min_price=$5&sea_max_price=$6&sortby=$7&ordby=$8&page=$9 [L]

 

RewriteRule ^keyword-search/([^/]*)/([^/]*)/([^/]*)/([^/]*)\/$ keyword-search.php?txtsearch=$1&sortby=$2&ordby=$3&page=$4 [L]

 

RewriteRule ^wishlist/([^/]*)/([^/]*)\/$ wishlist.php?action=$1&page=$2 [L]

 

#RewriteRule ^product-advanced-search/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\/$ asearch.php?smlid=$1&sslid=$2&sgenid=$3&sbrandid=$4&sstyid=$5&sheelid=$6&smatid=$7&searchprice=$8&sortby=$9&ordby=$10&page=$11 [L]

 

RewriteRule ^product-details/([^/]*)/([^/]*)\/$ main-product.php?prod_id=$1&prod_name=$2 [L]

RewriteRule ^login/([^/]*)\/$ login.php?msg=$1 [L]

RewriteRule ^reseller/([^/]*)\/$ reseller.php?res_msg=$1 [L]

RewriteRule ^brands/([^/]*)/([^/]*)\/$ brands.php?baction=$1&page=$2 [L]

 

RewriteRule ^processing/([^/]*)/([^/]*)\/$ pro-order.php?porder=$1&page=$2 [L]

RewriteRule ^collected/([^/]*)/([^/]*)\/$ col-order.php?corder=$1&page=$2 [L]

RewriteRule ^dispatched/([^/]*)/([^/]*)\/$ dis-order.php?dorder=$1&page=$2 [L]

RewriteRule ^cancelled/([^/]*)/([^/]*)\/$ can-order.php?canorder=$1&page=$2 [L]

 

RewriteRule ^order-details/([^/]*)\/$ orderview.php?ord_id=$1 [L]

 

#set link start http://www.yourdomain.com

 

 

Regards

P.Balakrishnan.

Link to comment
https://forums.phpfreaks.com/topic/259545-help-need-for-htaccess-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.