Forum Moderators: phranque

Message Too Old, No Replies

Help me to merge 2 mod rewrite rule

How to merge two 2 mod_rewrite rules on appache server using .htaccess

         

manov2k

3:37 am on Aug 3, 2007 (gmt 0)

10+ Year Member



I've a CMS and wordpress blog installed on the root of my site (mistake, I should have installed WP on a sub folder)Both has index.php file extension. So I changed CMS's file to index1.php

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]

In this case second rule is not working. But if I put second rule above the wordpress rule it works and vice-versa

It looks like both rules can be merged to single. So please help me.

Thanks :)
Mahesh Bhat

jdMorgan

5:31 am on Aug 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You are going to need to move one or both applications into subdirectories. Otherwise, there is no way --based on the URL alone-- to tell which application script to rewrite to.

Jim