Forum Moderators: phranque
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress Redirect 301 /template.asp?page=qui_nous&titre=qui_nous http://www.mysite.com/qui-sommes-nous/
RewriteEngine On
RewriteBase /
#
# Redirect specific .asp URLs to WP+SEF-format URLs
RewriteCond %{QUERY_STRING} ^page=qui_nous&titre=qui_nous$
RewriteRule ^template\.asp$ http://www.example.com/nous-sommes-la-meme/? [R=301,L]
#
# Redirect direct client requests for URL-path /index.php to / to avoid duplicate content
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.php([?#][^\ ]*)?\ HTTP/
RewriteRule ^index\.php$ http://www.example.com/ [R=301,L]
#
# Redirect requests for non-blank, non-canonical hostnames to canonical hostname
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
#
# BEGIN WordPress
# Except for requests for /index.php and for the most-frequently-requested
# filetypes that WP cannot generate, rewrite all URL requests which do not
# resolve to an existing file or directory to the WordPress script filepath
RewriteCond $1 !^index\.php$
RewriteCond $1 !\.(gif|jpe?g|png|ico|css|js)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php [L]
# END WordPress
[edited by: jdMorgan at 5:59 pm (utc) on Aug 6, 2010]
##### New code ####
#
RewriteEngine On
RewriteBase /
#
# Redirect specific .asp URLs to WP+SEF-format URLs
RewriteCond %{QUERY_STRING} ^([^&]*&)*page=qui_nous(&.*)?$
RewriteRule ^template\.asp$ http://www.atable.com/qui-sommes-nous/ [R=301,L]
#
# Redirect direct client requests for URL-path /index.php to / to avoid duplicate content
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.php([?#][^\ ]*)?\ HTTP/
RewriteRule ^index\.php$ http://www.atable.com/ [R=301,L]
#
# Redirect requests for non-blank, non-canonical hostnames to canonical hostname
RewriteCond %{HTTP_HOST} !^(www\.atable\.com)?$
RewriteRule ^(.*)$ http://www.atable.com/$1 [R=301,L]
#
# BEGIN WordPress
# Except for requests for /index.php and for the most-frequently-requested
# filetypes that WP cannot generate, rewrite all URL requests which do not
# resolve to an existing file or directory to the WordPress script filepath
RewriteCond $1 !^index\.php$
RewriteCond $1 !\.(gif|jpe?g|png|ico|css|js)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php [L]
# END WordPress
[edited by: jdMorgan at 5:58 pm (utc) on Aug 6, 2010]
[edit reason] Added code tags for formatting. [/edit]
###### PHP compatibility ######
AddType x-mapp-php5 .php
###### WordPress original code #####
# BEGIN WordPress
# <IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteBase /
# RewriteRule ^index\.php$ - [L]
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule . /index.php [L]
# </IfModule>
# END WordPress
##### Wordpress Optimized code with my redirects ####
# Intro
RewriteEngine On
RewriteBase /
# My specific Redirect default.asp to WP Homepage
RewriteRule ^default\.asp$ http://www.example.com/ [R=301,L]
# My Specific Redirects from old site (.asp URLs containing ?string to WP+SEF-format URLs)
# Redirects template.asp?page=mystring containging "?page=mystring" and any other parameter to specified new URL www.example.com/mynewurl
# One may remove the "?" at the end of the target URL to keep parameters in the string.
RewriteCond %{QUERY_STRING} ^([^&]*&)*page=mystring(&.*)?$
RewriteRule ^template\.asp$ http://www.example.com/mynewurl/? [R=301,L]
# WP optimized code
# Redirect direct client requests for URL-path /index.php to / to avoid duplicate content
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.php([?#][^\ ]*)?\ HTTP/
RewriteRule ^index\.php$ http://www.example.com/ [R=301,L]
# Redirect requests for non-blank, non-canonical hostnames to canonical hostname
RewriteCond %{HTTP_HOST} !^(www\.atable\.com)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
# Except for requests for /index.php and for the most-frequently-requested
# filetypes that WP cannot generate, rewrite all URL requests which do not
# resolve to an existing file or directory to the WordPress script filepath
RewriteCond $1 !^index\.php$
RewriteCond $1 !\.(gif|jpe?g|png|ico|css|js)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php [L]
# END WordPress
# My Specific Redirects from old site (.asp URLs containing ?string to
# WP+SEF-format URLs). Redirects template.asp?page=mystring
# containing "?page=mystring" and any other parameter to specified new
# URL www.example.com/mynewurl One may remove the "?" at the end of the
# target URL to keep parameters in the string.
RewriteCond %{QUERY_STRING} ^([^&]*&)*page=mystring(&.*)?$
RewriteRule ^template\.asp$ http://www.example.com/mynewurl/? [R=301,L]
# WP optimized code
# Redirect direct client requests for URL-path /index.php to / and
# for /folder/index.php to /folder/ Likewise for default.php direct
# requests in root or in folder, and force www and strip parameters
# at same time, to avoid duplicate content.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|default)\.(php|html?|asp)([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|default)\.(php|html?|asp)$ http://www.example.com/$1? [R=301,L]
# I'd add an additional redirect here to strip all parameters and force www
# for all requests with parameters that have made it thus far.
# Redirect requests for non-blank, non-canonical hostnames to canonical hostname
RewriteCond %{HTTP_HOST} !^(www\.atable\.com)?$
RewriteRule ^(.*)$ http://www.example.com/$1? [R=301,L]
# Except for requests for /index.php and for the most-frequently-requested
# filetypes that WP cannot generate, rewrite all URL requests which do not
# resolve to an existing file or directory to the WordPress script filepath
RewriteCond $1 !^index\.php$
RewriteCond $1 !\.(gif|jpe?g|png|ico|css|js)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php [L]
# END WordPress
RewriteRule ^default\.asp$ http://www.atable.com/? [R=301,L]
# Redirect direct client requests for URL-path /index.php to / and for /folder/index.php to /folder/
# Likewise for default.php direct requests in root or in folder,
# and force www and strip parameters at same time, to avoid duplicate content.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|default)\.(php|html?|asp)([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|default)\.(php|html?|asp)$ http://www.example.com/$1? [R=301,L]
##### Wordpress Optimized code with my redirects ####
# Intro
RewriteEngine On
RewriteBase /
# My specific Redirect default.asp to WP Homepage
RewriteRule ^default\.asp$ http://www.atable.com/? [R=301,L]
# My Specific Redirects from old site (.asp URLs to WP+SEF-format URLs)
# One may remove the "?" at the end of the target URL to keep parameters in the string.
RewriteCond %{QUERY_STRING} ^([^&]*&)*page=qui_nous(&.*)?$
RewriteRule ^template\.asp$ http://www.atable.com/qui-sommes-nous/? [R=301,L]
# WP optimized code #
# Redirect direct client requests for URL-path /index.php to / and for /folder/index.php to /folder/
# Likewise for default.php direct requests in root or in folder,
# and force www and strip parameters at same time, to avoid duplicate content.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|default)\.(php|html?|asp)([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|default)\.(php|html?|asp)$ http://www.example.com/$1? [R=301,L]
# I'd add an additional redirect here to strip all parameters and force www
# for all requests with parameters that have made it thus far.
# Redirect requests for non-blank, non-canonical hostnames to canonical hostname
RewriteCond %{HTTP_HOST} !^(www\.atable\.com)?$
RewriteRule ^(.*)$ http://www.atable.com/$1? [R=301,L]
# Except for requests for /index.php and for the most-frequently-requested
# filetypes that WP cannot generate, rewrite all URL requests which do not
# resolve to an existing file or directory to the WordPress script filepath
RewriteCond $1 !^index\.php$
RewriteCond $1 !\.(gif|jpe?g|png|ico|css|js)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php [L]
# END WordPress
# I'd add an additional redirect here to strip all parameters and force www
# for all requests with parameters that have made it thus far.
# Redirect requests for non-blank, non-canonical hostnames to canonical hostname
RewriteCond %{HTTP_HOST} !^(www\.atable\.com)?$
RewriteRule ^(.*)$ http://www.atable.com/$1? [R=301,L]
# Redirect direct client requests for URL-path /index.php to / and for /folder/index.php to /folder/
# Likewise for default.php direct requests in root or in folder,
# and force www and strip parameters at same time, to avoid duplicate content.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|default)\.(php|html?|asp)([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|default)\.(php|html?|asp)$ http://www.atable.com/$1? [R=301,L]
http://www.atable.com/traiteur/coffrets-repas/index.php?utm_source=test
# Redirect direct client requests for URL-path /<anyfolder>/<index or default>.<php, html, htm, or asp>
# to /<anyfolder>/ and force www and strip the query string to avoid duplicate content.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|default)\.(php|html?|asp)([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|default)\.(php|html?|asp)$ http://www.atable.com/$1? [R=301,L]
And still, when I type:
http://www.atable.com/traiteur/coffrets-repas/index.php?utm_source=test
The page comes up without rewriting...
I've found some netlinking goes to a wrong URL: [atable.com...] How would I redirect from this wrong directory?
# Another specific Redirect to WP Homepage
RewriteRule ^a_table_traiteur/?$ http://www.atable.com/? [R=301,L]
# Redirect direct client requests for URL-path /index.php to / and for /folder/index.php to /folder/
# Likewise for default.php direct requests in root or in folder,
# and force www and strip parameters at same time, to avoid duplicate content.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|default)\.(php|html?|asp)([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|default)\.(php|html?|asp)$ http://www.atable.com/$1? [R=301,L]
###### PHP compatibility ######
AddType x-mapp-php5 .php
###### WordPress original code #####
# BEGIN WordPress
# <IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteBase /
# RewriteRule ^index\.php$ - [L]
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule . /index.php [L]
# </IfModule>
# END WordPress
##### Wordpress Optimized code with my redirects ####
# code by http://www.webmasterworld.com/apache/4182512.htm
# Intro
RewriteEngine On
RewriteBase /
# My specific Redirect default.asp to WP Homepage
RewriteRule ^default\.asp$ http://www.atable.com/? [R=301,L]
# Another specific Redirect to WP Homepage
RewriteRule ^atable_traiteur/?$ http://www.atable.com/? [R=301,L]
# My Specific Redirects from old site (.asp URLs to WP+SEF-format URLs)
# One may remove the "?" at the end of the target URL to keep parameters in the string.
RewriteCond %{QUERY_STRING} ^([^&]*&)*page=qui_nous(&.*)?$
RewriteRule ^template\.asp$ http://www.atable.com/qui-sommes-nous/? [R=301,L]
# and many more alike
# WP optimized code
# Redirect direct client requests for URL-path /index.php to / and for /folder/index.php to /folder/
# Likewise for default.php direct requests in root or in folder,
# and force www and strip parameters at same time, to avoid duplicate content.
# NB: should I really?
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|default)\.(php|html?|asp)([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|default)\.(php|html?|asp)$ http://www.atable.com/$1? [R=301,L]
# I'd add an additional redirect here to strip all parameters and force www
# for all requests with parameters that have made it thus far.
# Redirect requests for non-blank, non-canonical hostnames to canonical hostname
# NB: without removing the parameters in string so no final "?"
RewriteCond %{HTTP_HOST} !^(www\.atable\.com)?$
RewriteRule ^(.*)$ http://www.atable.com/$1 [R=301,L]
# Except for requests for /index.php and for the most-frequently-requested
# filetypes that WP cannot generate, rewrite all URL requests which do not
# resolve to an existing file or directory to the WordPress script filepath
RewriteCond $1 !^index\.php$
RewriteCond $1 !\.(gif|jpe?g|png|ico|css|js)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php [L]
# END WordPress
http://www.atable.com/traiteur/petits-dejeuners/brunchs/ with 3 products inside, http://www.atable.com/traiteur/petits-dejeuners/brunchs/lintegral http://www.atable.com/(name-of-page) http://www.atable.com/traiteur/(name-of-category)/(name-of-subcategory) http://www.atable.com/traiteur/buffets-et-cocktails/(name-of-subcategory)/(name-of-subsubcategory) http://www.atable.com/traiteur/(name-of-category)/(name-of-subcategory)/name-of-product www.atable.com/template.asp?page=xyz http://www.atable.com/qui-sommes-nous/?glcid=xyz
http://www.atable.com/traiteur/nouveautes?glcid=xyz
http://www.atable.com/traiteur/coffrets-repas/?glcid=xyz
http://www.atable.com/traiteur/coffrets-repas/le-lunch-bag-sac-pique-nique/?utm_source=test
http://www.atable.com/traiteur/buffets-et-cocktails/buffets/buffet-sandwich-tarte-salade-froid?utm_campaign=test&utm_media=mail
# Redirect direct client requests for URL-path /index.php to / and for /folder/index.php to /folder/
# Likewise for default.php direct requests in root or in folder,
# and force www and strip parameters at same time, to avoid duplicate content.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|default)\.(php|html?|asp)([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|default)\.(php|html?|asp)$ http://www.atable.com/$1? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|default)\.(php|html?|asp)([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|default)\.(php|html?|asp)$ http://www.atable.com/$1 [R=301,L]
# Redirect requests for non-blank, non-canonical hostnames to canonical hostname
# do not remove the parameters in string, so skip the original final "?" on target URL
RewriteCond %{HTTP_HOST} !^(www\.atable\.com)?$
RewriteRule ^(.*)$ http://www.atable.com/$1 [R=301,L]
/wp-admin/admin.php?page=wpsc-edit-groups
<a href='#' onclick='return showedit_categorisation_form()'>
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(index|default)\.(php|html?|asp)([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)(index|default)\.(php|html?|asp)$ http://www.atable.com/$1 [R=301,L]