Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 重写后URL重定向不起作用_.htaccess_Url_Url Rewriting - Fatal编程技术网

.htaccess 重写后URL重定向不起作用

.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

我已经在.htaccess文件中编写了URL重写代码。我想从/CodecanyonSocial/settings.php重定向到/CodecanyonSocial/index.php?a=profile&u=username 所以我已经完成了重写的代码。但它不起作用。这里CodecanyonSocial是基本(主)文件夹(站点位于CodecanyonSocial文件夹中)


重新启动发动机
重写基/
重写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>