Hello Server guru. I've a CMS and wordpress blog installed on the root of my site (mistake, I should have installed WP on a sub folder) So my .htaccess file contains two mod_rewrite rule one for Wordpress and another one for other CMS. Below is the code # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress AddHandler server-parsed .html AddHandler server-parsed .htm Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9-]+)/?$ cat.php?pagename=$1 [L] RewriteRule ^([A-Za-z0-9-]+)/?.html$ cat.php?pagename=$1 [L] RewriteRule category(.*)/(.*)\.html$ /cat.php?Start=$1&pagename=$2 [L] RewriteRule category(.*)/(.*)/$ /cat.php?Start=$1&pagename=$2 [L] RewriteRule page(.*)\.php$ /item.php?item=$1 [L] Now the second rule is not working. But if I put second rule above the wordpress rule it works... but wordpress doesn't work It looks like both rules can be merged to single. So please help me... I'll send $10 to your PP account if it is successful Thanks Mahesh Bhat
Oops... 50 views but no response! AMAZING.... I thought there are too many intelligent techy guys here
try something like. AddHandler server-parsed .html AddHandler server-parsed .htm Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9-]+)/?$ cat.php?pagename=$1 [L] RewriteRule ^([A-Za-z0-9-]+)/?.html$ cat.php?pagename=$1 [L] RewriteRule category(.*)/(.*)\.html$ /cat.php?Start=$1&pagename=$2 [L] RewriteRule category(.*)/(.*)/$ /cat.php?Start=$1&pagename=$2 [L] RewriteRule page(.*)\.php$ /item.php?item=$1 [L] RewriteRule . /index.php [L]
ndreamer, that will probably cause problems. The RewriteCond used to check if the request is not for a existing file or directory is not applied to the last rule for example. Also, all you did was copy the rules over. The problem was most likely in this line used for the blog: RewriteRule ^([A-Za-z0-9-]+)/?$ cat.php?pagename=$1 [L] Code (markup): That conflicts with the WordPress rule: RewriteRule . /index.php [L] Code (markup): I think you will have to do without that rule for the blog: This should work: AddHandler server-parsed .html AddHandler server-parsed .htm Options +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Blog: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9-]+)\.html$ cat.php?pagename=$1 [L] RewriteRule ^category(.*)/(.*)(/|\.html)$ cat.php?Start=$1&pagename=$2 [L] RewriteRule ^page(.*)\.php$ /item.php?item=$1 [L] # WordPress: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> Code (markup):