【问题标题】:URL Redirection not working after rewriting重写后 URL 重定向不起作用
【发布时间】:2014-03-28 12:19:47
【问题描述】:

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

    <IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^CodecanyonSocial/index.php?a=profile&u=([A-Za-z0-9-]+)/?$ CodecanyonSocial/settings.php [QSA,L]

</IfModule>

【问题讨论】:

  • 您希望在浏览器中显示的 URL 是什么?
  • 你想从/CodecanyonSocial/settings.php重定向到/CodecanyonSocial/index.php?a=profile&amp;u=username。 username 在此重定向中的值在哪里?
  • 它在本地主机中,文件夹是 CodecanyonSocial
  • @user3131633:你还是没有回答我的问题
  • 来自会话变量

标签: .htaccess url url-rewriting


【解决方案1】:

试试这个……

 <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>

【讨论】:

    猜你喜欢
    • 2011-10-28
    • 2015-01-29
    • 1970-01-01
    • 2015-09-06
    • 1970-01-01
    • 2021-08-25
    • 1970-01-01
    • 1970-01-01
    • 2014-08-30
    相关资源
    最近更新 更多