Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的 URL:
http://example.com/directory/index.php?q=anything
这样 PHP 将使用 $_GET['q'] 加载测试变量。
我希望在我的 .htaccess 中将其简化为:
http://example.com/directory/anything.html
我该怎么做呢?
也许你可以添加这样的东西.htaccess
.htaccess
RewriteEngine on RewriteRule ([0-9A-Za-z-\+._]+)\.html$ ./index.php?q=$1
我自己解决了这个问题 :: 这是 .htaccess 代码
RewriteEngine On RewriteRule ^directory/([^/]*)\.html$ /directory/index.php?q=$1 [L]