Hi,
The below url works fine with my rule shown below.
http://www.domain.com/apple/abc.php
RewriteRule ^(.*)/(.*php)$ /view.php?id=$2&folder=$1
BUT
When i try the url http://www.domain.com/def.php i want to work as it work like above.
RewriteRule ^(.*php)$ /view.php?id=$1
Basicly if there is a folder it need to pass the foldername and the php page name to view.php. If there is no folder it should only pass the php page name.
I am trying for the last 2 hrs . Any help would be really appricated.
Htaccess: Rules for files in folders works but !
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: Htaccess: Rules for files in folders works but !
Maybe you could just try making the folder portion of the regex optional. Instead of:
Try:
Code: Select all
RewriteRule ^(.*)/(.*php)$ /view.php?id=$2&folder=$1Code: Select all
RewriteRule ^((.*)/)?(.*php)$ /view.php?id=$2&folder=$1