I am currently running my site on a customized CMS, but I have installed Wordpress to change the front page into a blog. Wordpress is in the /blog directory, but it can be shown in any directory by changing the setting in the options and moving the index.php and .htaccess files over. However, I already have an .htaccess in the root html directory, and they are creating conflicts. Here are the contents of my current .htaccess file: # -FrontPage-ii Options FollowSymlinks RewriteEngine On RewriteBase / RewriteRule ^reviews/review-(\d+)-(\d+).htm$ reviews_wrapper.php?id=$1&page=$2 RewriteRule ^reviews.htm$ reviews_wrapper.php RewriteRule ^reviews/(.*)/(.*)/([^\/]*)$ article_lookup.php?cat=$1&article=$2&file=$3 RewriteRule ^reviews.rss$ http://feeds.feedburner.com/hcw [R=permanent] #RewriteCond %{HTTP_REFERER} !^http://.*hardcoreware.net/.* [NC] #RewriteRule ^image.php.*$ images/nohotlinking.gif php_value include_path .:/php/includes:/usr/share/php:/var/www/html/included/:/var/www/html/forum:/var/www/html/phpads:/var/www/html/shoutbox:/var/www/html IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* <Limit GET POST> order deny,allow deny from all allow from all </Limit> <Limit PUT DELETE> order deny,allow deny from all </Limit> Code (markup): And here is what needs to be there: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog/index.php [L] </IfModule> # END WordPress Code (markup): As you can see, they both try to do the same thing, so when I put the WP content in there, it takes over all the redirects. Can someone help me out here? It would be greatly appreciated
Just add the L flag to your existing rules and stick the WordPress ones in below. A request for reviews/review-1-2.htm will be rewritten to the reviews_wrapper.php script. With the L (last) flag, it will stop processing the rewrite rules there and start a new request for reviews_wrapper.php?id=1&page=2. Without the L flag, it will continue and instead get rewritten to the blog/index.php file. reviews_wrapper.php?id=1&page=2 doesn't match any patterns for the existing rules, so it'll move onto the WordPress rule. Since there's a RewriteCond that ensures it only rewrites to the WP script if the requested file does not exist, it won't apply here because reviews_wrapper.php does exist. Also, are you sure you want the rewritebase to be /blog/ if you want it to apply to the root folder?