|
Mod_rewrite
We have a oScommerce site installed in the subfolder /catalog.
We want to hide the folder name 'catalog' from the URL. However, there is a dynamic Web site in the root folder.
# Begin default subdomain redirect #
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [r=permanent,L]
# End default subdomain redirect #
# Begin cache control #
ExpiresActive on
<FilesMatch "\.(css|ico|gff|jpg|doc|ppc|gz|gzip|wav|mp3|bmp|pn g|pdf|mov|zip|js|jpeg|avi|gif|exe|gcf)$">
FileETag All
ExpiresDefault "now plus 4 hours"
Header set Cache-Control "max-age=14400, public"
</FilesMatch>
# End cache control #
DirectoryIndex home.html home.php index.html index.php
AddType application/x-httpd-php .htm .html
Options +FollowSymLinks
# AddHandler application/x-httpd-php4 .php
# to make the default page home.html
#AddHandler application/x-httpd-php html
RemoveHandler .html .htm
RewriteEngine On
RewriteBase /catalog/
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-([0-9]+).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-([0-9]+).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-([0-9]+).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-([0-9]+).html$ article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-au-(.*).html$ articles.php?authors_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-([0-9]+).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-([0-9]+).html$ product_reviews_info.php?products_id=$2&%{QUERY_ST RING}
RewriteRule ^(.*)-i-([0-9]+).html$ information.php?info_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-by-(.*).html$ all-products.php?fl=$2&%{QUERY_STRING}
Please guide me how to mask/ hide the catalog folder by modifying the .htaccess code?
Thanks in advance.
Last edited by soori; 11-20-2009 at 01:32 PM..
|