Hi,
I have started using Mod Rewrite and have a problem with displaying sub-directories re-writes.
I'm trying to rewrite the following structure
/menu/submenu/content/
I'm using RewriteRule ^/([^/]+)/?([^/]*)/?([^/]*)/?$ /content.aspx?pname=$1&pname2=$2&content=$3 [L]
This does not work and it seems to conflict with an existing rule as follows:
RewriteRule ^adverts/([^/]+)/?([^/]*)/?([^/]*)/?([^/]*)/?$ /detail.aspx?mak_id=$2&mod_id=$3&adv=$4 [L]
This is the code used in the .htaccess file:
######################################
RewriteEngine On
RewriteBase /web/content/
RewriteBase /
############ CMS ############
RewriteRule ^/([^/]*)/?$ /menu.aspx?pname=$1 [L]
RewriteRule ^/([^/]+)/?([^/]*)/?$ /submenu.aspx?pname=$1&pname2=$2 [L]
RewriteRule ^/([^/]+)/?([^/]*)/?([^/]*)/?$ /content.aspx?pname=$1&pname2=$2&content=$3 [L]
#################################
############ Adverts ############
RewriteRule ^taxis-for-sale/pg/([^/]+)/?$ /adverts.aspx?pg=$1 [L]
RewriteRule ^taxis-for-sale/([^/]+)/?([^/]*)/?([^/]*)/?([^/]*)/?$ /detail.aspx?mak_id=$2&mod_id=$3&adv=$4 [L]
RewriteRule ^taxis-for-sale/ /adverts.aspx [L]
#################################
Can you please advise how I can implement the structure susccessfully without having to use the structure with the rule:
RewriteRule ^content/([^/]+)/?([^/]*)/?([^/]*)/?$ /content.aspx?pname=$1&pname2=$2&content=$3 [L]
This rule works but I don't want to use the content directory in front. The rule I would like to use is:
RewriteRule ^/([^/]*)/?$ /menu.aspx?pname=$1 [L]
RewriteRule ^/([^/]+)/?([^/]*)/?$ /submenu.aspx?pname=$1&pname2=$2 [L]
RewriteRule ^/([^/]+)/?([^/]*)/?([^/]*)/?$ /content.aspx?pname=$1&pname2=$2&content=$3 [L]