我想要以下网址:
http://localhost/new/post?url=sample-post-one
通过 htaccess mod_rewrite 看起来像这样:
http://localhost/new/post/sample-post-one/
这可能是一个已经问过的问题或类似的问题,但几个小时以来我一直在尝试解决这个问题,但没有找到解决方案。
任何帮助将不胜感激。谢谢!
更新 这是我尝试过的
<Files .htaccess,.svn> order allow,deny deny from all </Files>
Options +FollowSymlinks
# For Removing .php extension from files
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
# Rewrite rule
RewriteRule ^post/([a-zA-Z0-9_-]+)/?$ post?url=$1 [L]