Forum Moderators: phranque
i use .htaccess file to 301 redirect all URLs from [domain.com...] to [domain.com...] to avoid URL canonicalization problem. the .htaccess i put in root is:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\.domain\.com [NC]
RewriteRule (.*) [domain.com...] [R=301,L]
it had been working fine for all pages in root and subdirectories...
until i added a blog/wordpress in, say, /wordpress subdirectory. i enabled the search engine friendly URL option in wordpress, then put the .htaccess file in /wordpress as instructed by wordpress admin panel:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
now the 301 redirect in /wordpress no longer works, [domain.com...] does not redirect to [domain.com...] anymore.
i tried to copy all lines in first .htaccess file (in root) and add them to 2nd .htaccess file (the one in /wordpress), tried my best to modify, still it does not work.
could someone help?
thanks.
I added a line:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteOptions inherit
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
now when i go to [domain.com...] it gives me 404 error.
any idea? thanks.
RewriteRule . /wordpress/index.php [L]
RewriteRule .* /wordpress/index.php [L]
See the basic regular-expressions tutorial cited in our forum charter [webmasterworld.com] for more info.
Jim