.htaccess specific problem with formation
If format is Dir-$mrpagename-$mrid.htm
then .htaccess is
Options +FollowSymLinks
RewriteEngine on
RewriteRule Dir-(.*)-(.*)\.htm$ index.php?page=browse&category=$2
for http://sitename/Dir-dirbrowse-3.htm
But if format is $mrpagename-$mrid
then what will be .htaccess for http://sitename/dirb开发者_如何转开发rowse-3
?
RewriteRule ^([a-z0-9]+)-(\d+)$ /index.php?page=browse&category=$2 [NC,L]
Based on your example dirbrowse-3
($mrpagename-$mrid
) I put these "restrictions" to properly match URLs (you will need to modify this rule if these parts can have any other characters):
$mrpagename
part can be letters or digits$mrid
part can only be digits
I did it (restrictions) because your original rule (the (.*)
part) is quite broad and can catch other forms of URLs as well which may lead to category
parameter having invalid data.
精彩评论