.htaccess 重写后URL重定向不起作用
我已经在.htaccess文件中编写了URL重写代码。我想从/CodecanyonSocial/settings.php重定向到/CodecanyonSocial/index.php?a=profile&u=username 所以我已经完成了重写的代码。但它不起作用。这里CodecanyonSocial是基本(主)文件夹(站点位于CodecanyonSocial文件夹中).htaccess 重写后URL重定向不起作用,.htaccess,url,url-rewriting,.htaccess,Url,Url Rewriting,我已经在.htaccess文件中编写了URL重写代码。我想从/CodecanyonSocial/settings.php重定向到/CodecanyonSocial/index.php?a=profile&u=username 所以我已经完成了重写的代码。但它不起作用。这里CodecanyonSocial是基本(主)文件夹(站点位于CodecanyonSocial文件夹中) 重新启动发动机 重写基/ 重写cond%{REQUEST_FILENAME}-D 重写规则^CodecanyonSocia
重新启动发动机
重写基/
重写cond%{REQUEST_FILENAME}-D
重写规则^CodecanyonSocial/index.php?a=profile&u=([a-Za-z0-9-]+)/?$CodecanyonSocial/settings.php[QSA,L]
试试这个
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /CodecanyonSocial/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^CodecanyonSocial/index.php?a=profile&u=([A-Za-z0-9-]+)/?$ CodecanyonSocial/settings.php [QSA,L]
</IfModule>
重新启动发动机
RewriteBase/CodecanyonSocial/
重写cond%{REQUEST_FILENAME}-D
重写规则^CodecanyonSocial/index.php?a=profile&u=([a-Za-z0-9-]+)/?$CodecanyonSocial/settings.php[QSA,L]
您想在浏览器中显示的URL是什么?您想从/CodecanyonSocial/settings.php
重定向到/CodecanyonSocial/index.php?a=profile&u=username
。username
在此重定向中从何处获取其值?它位于localhost中,而文件夹位于CodecanyonSocial@user3131633:您仍然没有从会话变量中回答我的问题
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /CodecanyonSocial/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^CodecanyonSocial/index.php?a=profile&u=([A-Za-z0-9-]+)/?$ CodecanyonSocial/settings.php [QSA,L]
</IfModule>