Pri*_*alj 3 apache .htaccess mod-rewrite redirect url-rewriting
我检查了许多其他类似的问题,但我想不出一个可以正常工作的 .htaccess 规则。
我有一个包含知识库系统 (knowledgebase.php) 的服务器。我不想knowledgebase.php在 URL 中显示这个,永远。
我想要的例子:
https://help.thecrypto.app应该显示相同的 url(现在它在您访问时显示https://help.thecrypto.app/knowledgebase.php)
https://help.thecrypto.app/knowledgebase.php?article=1应该显示 URL https://help.thecrypto.app/?article=1
我怎样才能做到这一点?
我尝试了很多选择,包括:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /knowledgebase.php?/$1 [L]
Run Code Online (Sandbox Code Playgroud)
您能否尝试以下根据您显示的样本编写的内容。请在测试 url 之前清除浏览器缓存。
RewriteEngine ON
RewriteCond %{REQUEST_URI} ^/?$
RewritewriteRule ^ knowledgebase.php [L]
RewriteCond %{REQUEST_URI} ^/(knowledgebase) [NC]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/?article=1 [L]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
50 次 |
| 最近记录: |