Php 使用.httaccess重写url我尝试了几次,但失败了
使用.httaccess重写url我尝试了几次,但失败了 我正在尝试这样显示我的urlPhp 使用.httaccess重写url我尝试了几次,但失败了,php,.htaccess,url,redirect,cpanel,Php,.htaccess,Url,Redirect,Cpanel,使用.httaccess重写url我尝试了几次,但失败了 我正在尝试这样显示我的url https://codingeek.net/preview/html/banting-university 相反 https://codingeek.net/preview/index.php?tslug=banting-university&cat=html 我试过用这个 <IfModule mod_rewrite.c> RewriteEngine on RewriteCond
https://codingeek.net/preview/html/banting-university
相反
https://codingeek.net/preview/index.php?tslug=banting-university&cat=html
我试过用这个
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^preview/(.+)$ /preview/index.php?tslug=$1&cat=$2 [QSA,L]
</IfModule>
重新启动发动机
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^preview/(.+)$/preview/index.php?tslug=$1&cat=$2[QSA,L]
请在htaccess中替换
RewriteRule ^preview/(.+)$ /preview/index.php?tslug=$1&cat=$2 [QSA,L]
到
您的网站是否在此文件夹中有预览文件夹和index.php。根文件夹中的htaccess文件?我在本地试过,运行正常。您是否使用$_get['xxx']获取参数值?是的,我在该文件夹中有预览文件夹和index.php。此外,此文件夹中还有.htaccess文件。我使用$\u get['xxx']获取值。是的,如果您在预览文件夹中有index.php和htaccess,我会得到值。您应该在RewriteCond%{REQUEST_FILENAME}上使用:RewriteEngine写入htaccess-已重写COND%{REQUEST_FILENAME}-重写规则^(.+)/(.+)$index.php?tslug=$2&cat=$1[QSA,L]我已经做了,但没有成功。我在预览文件夹中使用它,但仍然不起作用。请提供网站的详细结构。是否在根文件夹中使用.htaccess?也许这个URl被重新写入了另一个文件。
RewriteRule ^preview/(.+)/(.+)$ /preview/index.php?tslug=$2&cat=$1 [QSA,L]