【问题标题】:Remove questionmark from URL with htaccess使用 htaccess 从 URL 中删除问号
【发布时间】:2013-09-04 09:03:16
【问题描述】:

我在从我的网址中删除问号时遇到问题。

现在 URL 如下所示:www.mydomain.com/development/p/?user=me

但我希望它是这样的:

现在 URL 如下所示:www.mydomain.com/development/p/me

我有这个 htaccess 文件:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} YOURSTRING=(.*)
RewriteRule ^(.*)$ /development/p/$1? [R=301,L]
 </IfModule>

有什么建议吗?

【问题讨论】:

  • 你在 httpd.conf 中启用 mod_rewrite 了吗?

标签: php .htaccess


【解决方案1】:

*只有在 httpd.conf 中启用 mod_rewrite 时才有效* 在根目录中创建一个 .htaccess 文件并将其放入其中:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^ index.php%{REQUEST_URI} [L]

【讨论】:

    猜你喜欢
    • 2016-01-09
    • 2015-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-27
    • 2021-10-02
    • 2015-01-20
    相关资源
    最近更新 更多