我一直在寻找很多教程,但没有人真正帮助我,我知道你们可以:我的网站有以下结构:
mywebsite.domain/?pg=somepage
但我想这样说:
Mywebsite.domain.sheption
我在下一个结构中找到的所有教程都在工作:mywebsite.Domain/file.php?pg= So,这样我就无法理解RewriteRule是如何使用我的结构的。
我试过:
RewriteEngine on
RewriteRule ^index/([0-9a-zA-Z]+) index.php/?pg=$1
还包括:
RewriteEngine on
RewriteRule ^index/([0-9a-zA-Z]+) index.php?pg=$1
但是我没有运气:( 注释:我的索引文件有.php扩展名)
发布于 2017-06-25 23:05:41
你可以这样做-
RewriteRule ^(.*)$ /index.php?pg=$1 [L]
这将把mywebsite.domain/somepage
重定向到mywebsite.domain/index.php?pg=somepage
或者完全配置-
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?pg=$1 [L]
</IfModule>
想了解更多信息- 重写
https://stackoverflow.com/questions/44751245
复制相似问题