我的根目录中有一个Subdirecotory,其中包含一些PHP文件(www / services / files.php)。
当前网址: http://example.com/index.php?pageID=services/myservice
我希望它是: http://example.com/services/myservice
我的代码:
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?pageID=/services$1 [L,QSA]
您希望使它显示为两个子对象,因此我将对这种类型的URL结构使用此代码。使用。*太贪心了。
这将允许您使用 http://example.com/services/myservice
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?pageID=$1/$2 [L]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句