example.com.au/directory1/nsw/目前在我下面的目录中.htaccess RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ S_NSW.php?p=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ S_NSW.php?p=$1S_NSW.php 当前的文件名.htaccess是为了使网址看起来像example.com.au/directory1/suburb-nsw上面的代码有效,但是我需要通过添加分页并使 url 看起来像example.com.au/directory1/suburb-nsw/1/example.com.au/directory1/suburb-nsw/2/example.com.au/directory1/suburb-nsw/3/
1 回答
白板的微信
TA贡献1883条经验 获得超3个赞
解决了,太简单了。通过将以下行添加到根 .htaccss 文件中:
RewriteRule ^([^/]+)/([^/]+)-([^/]+)/([^/]+)/?$ /$1/$3/S_NSW.php?p=$2&pi=$4 [L,NC,QSA,NE]
还可以通过将以下代码添加到 example.com.au/directory1/suburb-nsw
RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ S_NSW.php?p=$1RewriteRule ^([a-zA-Z0-9_-]+)/$ S_NSW.php?p=$1 RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)/$ S_NSW.php?p=$1&pi=$2 [NC,L] RewriteRule ^nsw/([a-zA-Z0-9_-]+)/([0-9]+)/$ S_NSW.php?p=$1&pi=$2 [NC,L] RewriteRule ^([a-zA-Z0-9_-]+)-^nsw/([0-9]+)/$ S_NSW.php?p=$1&pi=$2 [NC,L]
- 1 回答
- 0 关注
- 108 浏览
添加回答
举报
0/150
提交
取消