Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Simple 301 redirect and Wordpress htaccess rules


agneslesage - 5:47 am on Nov 25, 2010 (gmt 0)


In fact, there is another question I wonder...

Is the code you provided me above (at the beginning of this post) meant to accomodate my complicate former requests? Or is it also more elaborate than the "JimMorgan code" people usually take as reference, which you provided in this forum some longer time ago?

Your code Dardna and other took as reference:

RewriteEngine on
# Unless you have set a different RewriteBase preceding this point,
# you may delete or comment-out the following RewriteBase directive:
RewriteBase /localhost/www.atable-new.com/
# if this request is for "/" or has already been rewritten to WP
RewriteCond $1 ^(index\.php)?$ [OR]
# or if request is for image, css, or js file
RewriteCond $1 \.(gif|jpg|jpeg|png|css|js|ico)$ [NC,OR]
# or if URL resolves to existing file
RewriteCond %{REQUEST_FILENAME} -f [OR]
# or if URL resolves to existing directory
RewriteCond %{REQUEST_FILENAME} -d
# then skip the rewrite to WP
RewriteRule ^(.*)$ - [S=1]
# else rewrite the request to WP
RewriteRule . /index.php [L]
# END WordPress


The code you provided me here (before we complicated further):

RewriteEngine On
RewriteBase /
#
# (here came some specific redirect rules)
#
# 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


If this latter one is more advanced (as I suspect), then how should I adapt for my rewritebase to work?
I am trying to replicate the same trick to change the localbase... but I get an error message even on the Homepage ("the page is not redirected properly - FF detects that the server redirects the request for this page in a manner that wont succeed"


RewriteEngine On
RewriteBase /
#
# (here came some specific redirect rules)
#
# 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://localhost/www.atable-new.com/ [R=301,L]
#
# Redirect requests for non-blank, non-canonical hostnames to canonical hostname
RewriteCond %{HTTP_HOST} !^(www\.atable-new\.com)?$
RewriteRule ^(.*)$ http://localhost/www.atale-new.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 ^(.+)$ /atable-new/index.php [L]
# END WordPress


Thyanks for your help

Agnes


Thread source:: http://www.webmasterworld.com/apache/4182512.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com