Forum Moderators: phranque
RewriteEngine on
php_flag register_globals on
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.example.co.uk/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^example.co.uk
RewriteRule (.*) http://www.example.co.uk [R=301,L]
RewriteCond %{HTTP_HOST} ^www.forum.example.co.uk
RewriteRule (.*) http://www.example.co.uk/forum [R=301,L]
RewriteCond %{HTTP_HOST} ^forum.example.co.uk
RewriteRule (.*) http://www.example.co.uk/forum [R=301,L]
RewriteBase /
RewriteRule ^(.*)-p-(.*)$ product_info?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*)$ index?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-(.*)$ index?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-(.*)$ popup_image?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-by-(.*)$ all-products?fl=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-(.*)$ articles?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-(.*)$ article_info?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-au-(.*)$ articles?authors_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-(.*)$ product_reviews?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-(.*)$ product_reviews_info?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-f-(.*)$ faqdesk_info?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fc-(.*)$ faqdesk_index?faqPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fri-(.*)$ faqdesk_reviews_info?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fra-(.*)$ faqdesk_reviews_article?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-(.*)$ information?info_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-links-(.*)$ links?lPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pm-([0-9]+)$ info_pages?pages_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-n-(.*)$ newsdesk_info?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nc-(.*)$ newsdesk_index?newsPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nri-(.*)$ newsdesk_reviews_info?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nra-(.*)$ newsdesk_reviews_article?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-po-([0-9]+)$ pollbooth?pollid=$2&%{QUERY_STRING}
# Strip Extension and Generate Rule
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
# Redirect to New URL Generated Above
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/\ ]+/)*[^.\ ]+\.php\ HTTP/
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(([^/]+/)*[^.]+)\.php$ http://www.example.co.uk/$1 [R=301,L]
RewriteCond $1 !admin/
RewriteCond %{SERVER_PORT} =80
RewriteRule ^(.*)-p-(.*)$ product_info?products_id=$2&%{QUERY_STRING}
RewriteRule ^[^\-]+-p-(.+)$ product_info?products_id=$1 [QSA,L]
RewriteRule ^([^\-]+-)+p-(.+)$ product_info?products_id=$2 [QSA,L]
[edited by: jdMorgan at 9:45 pm (utc) on Jul 11, 2010]
#Force Parse PHP Extensionless Files
<Files "checkout_shipping">
ForceType application/x-httpd-php
</Files>
<Files "checkout_payment">
ForceType application/x-httpd-php
</Files>
<Files "checkout_confirmation">
ForceType application/x-httpd-php
</Files>
<Files "checkout_success">
ForceType application/x-httpd-php
</Files>
<Files "checkout_shipping_address">
ForceType application/x-httpd-php
</Files>
<Files "checkout_payment_address">
ForceType application/x-httpd-php
</Files>
<Files "checkout_process">
ForceType application/x-httpd-php
</Files>
#Enable Engine and Allow Globals
RewriteEngine on
php_flag register_globals on
Options +FollowSymLinks
#Direct to landing page if index.php is requested
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.example.co.uk/$1 [R=301,L]
#Direct to landing page if no www
RewriteCond %{HTTP_HOST} ^example.co.uk
RewriteRule (.*) http://www.example.co.uk [R=301,L]
#redirect to slash if no slash
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteCond %{REQUEST_URI} !checkout*
RewriteRule (.*)$ http://www.example.co.uk/$1/ [R=301,L]
# Strip Extension and Generate Rule with a slash at end
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)/$ $1.php
# Redirect to New URL Generated Above with slash if requested a .php
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/\ ]+/)*[^.\ ]+\.php\ HTTP/
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(([^/]+/)*[^.]+)\.php$ http://www.berrywoods.co.uk/$1/ [R=301,L]
#Ultimate SEO START
RewriteBase /
RewriteRule ^(.*)-p-(.*)$ product_info?products_id=$2&% [QSA,L]
RewriteRule ^(.*)-c-(.*)$ index.php?cPath=$2&% [QSA,L]
RewriteRule ^(.*)-m-(.*)$ index.php?manufacturers_id=$2&% [QSA,L]
RewriteRule ^(.*)-pi-(.*)$ popup_image.php?pID=$2&% [QSA,L]
RewriteRule ^(.*)-by-(.*)$ all-products.php?fl=$2&% [QSA,L]
RewriteRule ^(.*)-t-(.*)$ articles.php?tPath=$2&% [QSA,L]
RewriteRule ^(.*)-a-(.*)$ article_info.php?articles_id=$2&% [QSA,L]
RewriteRule ^(.*)-au-(.*)$ articles.php?authors_id=$2&% [QSA,L]
RewriteRule ^(.*)-pr-(.*)$ product_reviews.php?products_id=$2&% [QSA,L]
RewriteRule ^(.*)-pri-(.*)$ product_reviews_info.php?products_id=$2&% [QSA,L]
RewriteRule ^(.*)-f-(.*)$ faqdesk_info.php?faqdesk_id=$2&% [QSA,L]
RewriteRule ^(.*)-fc-(.*)$ faqdesk_index.php?faqPath=$2&% [QSA,L]
RewriteRule ^(.*)-fri-(.*)$ faqdesk_reviews_info.php?faqdesk_id=$2&% [QSA,L]
RewriteRule ^(.*)-fra-(.*)$ faqdesk_reviews_article.php?faqdesk_id=$2&% [QSA,L]
RewriteRule ^(.*)-i-(.*)$ information.php?info_id=$2&% [QSA,L]
RewriteRule ^(.*)-links-(.*)$ links.php?lPath=$2&% [QSA,L]
RewriteRule ^(.*)-pm-([0-9]+)$ info_pages.php?pages_id=$2&% [QSA,L]
RewriteRule ^(.*)-n-(.*)$ newsdesk_info.php?newsdesk_id=$2&% [QSA,L]
RewriteRule ^(.*)-nc-(.*)$ newsdesk_index.php?newsPath=$2&% [QSA,L]
RewriteRule ^(.*)-nri-(.*)$ newsdesk_reviews_info.php?newsdesk_id=$2&% [QSA,L]
RewriteRule ^(.*)-nra-(.*)$ newsdesk_reviews_article.php?newsdesk_id=$2&% [QSA,L]
RewriteRule ^(.*)-po-([0-9]+)$ pollbooth.php?pollid=$2&% [QSA,L]
#Ultimate SEO END
# Strip Extension and Generate Rule with a slash at end
# Parse Extensionless Files for PHP includes
#
<FilesMatch "checkout_(shipping(_address)?|payment(_address)?|success|confirmation|process)">
ForceType application/x-httpd-php
</FilesMatch>
#
#Enable Engine and Allow Globals
#
php_flag register_globals on
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
#
# Externally redirect direct client requests for "<anydirectory>/index.php" to "<anydirectory>/"
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/?#\ ]*/)index\.php([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]*/)*)index.php$ http://www.example.co.uk/$1 [R=301,L]
#
# Externally redirect to add a slash if no slash on extensionless URL
RewriteCond $1 !\.[a-z0-9]{1,5}$ [NC]
RewriteCond $1 !checkout
RewriteRule ^(.*[^/])$ http://www.example.co.uk/$1/ [R=301,L]
#
# Externally redirect to extensionless URL with a trailing slash if the client
# requests a URL ending in ".php" that resolves to an existing file
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/\ ]+/)*[^.\ ]+\.php\ HTTP/
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(([^/]+/)*[^.]+)\.php$ http://www.berrywoods.co.uk/$1/ [R=301,L]
#
# Externally redirect to canonical hostname if requested hostname has no
# leading www or if it is in FQDN format or has a port number appended
RewriteCond %{HTTP_HOST} ^example\.co\.uk [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.example\.co\.uk(\.|\.?:[0-9]+)$ [NC]
RewriteRule ^(.*)$ http://www.example.co.uk [R=301,L]
#
# Internally rewrite extensionless URL to php file if it
# exists and if no directory exists with the same name
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.+)/$ $1.php [L]
#
# Almost-Ultimate SEO (Optimized) START
# Internally rewrite 'friendly' URLs to CMS scripts
RewriteRule ^([^-]+-)+p-(.+)$ product_info?products_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+c-(.+)$ index.php?cPath=$2 [QSA,L]
RewriteRule ^([^-]+-)+m-(.+)$ index.php?manufacturers_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+pi-(.+)$ popup_image.php?pID=$2 [QSA,L]
RewriteRule ^([^-]+-)+by-(.+)$ all-products.php?fl=$2 [QSA,L]
RewriteRule ^([^-]+-)+t-(.+)$ articles.php?tPath=$2 [QSA,L]
RewriteRule ^([^-]+-)+a-(.+)$ article_info.php?articles_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+au-(.+)$ articles.php?authors_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+pr-(.+)$ product_reviews.php?products_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+pri-(.+)$ product_reviews_info.php?products_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+f-(.+)$ faqdesk_info.php?faqdesk_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+fc-(.+)$ faqdesk_index.php?faqPath=$2 [QSA,L]
RewriteRule ^([^-]+-)+fri-(.+)$ faqdesk_reviews_info.php?faqdesk_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+fra-(.+)$ faqdesk_reviews_article.php?faqdesk_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+i-(.+)$ information.php?info_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+links-(.+)$ links.php?lPath=$2 [QSA,L]
RewriteRule ^([^-]+-)+pm-([0-9]+)$ info_pages.php?pages_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+n-(.+)$ newsdesk_info.php?newsdesk_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+nc-(.+)$ newsdesk_index.php?newsPath=$2 [QSA,L]
RewriteRule ^([^-]+-)+nri-(.+)$ newsdesk_reviews_info.php?newsdesk_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+nra-(.+)$ newsdesk_reviews_article.php?newsdesk_id=$2 [QSA,L]
RewriteRule ^([^-]+-)+po-([0-9]+)$ pollbooth.php?pollid=$2 [QSA,L]
# Almost-Ultimate SEO (Optimized) END
[edited by: jdMorgan at 3:18 pm (utc) on Jul 14, 2010]
<FilesMatch "checkout_(shipping(_address)?|payment(_address)?|success|confirmation|process)">