【问题标题】:Redirect Old url with params using .htaccess [duplicate]使用.htaccess重定向带有参数的旧网址[重复]
【发布时间】:2013-02-03 21:05:39
【问题描述】:

我正在设置我的网站,但我有旧链接,我们现在正在使用对 SEO 友好的链接。 例如,老用户是 www.mysite.com/view_member.php?id=X

现在,我们的链接是 www.mysite.com/profile/X

我想知道如何使用 .htaccess

我试过了:

RedirectMatch ^/view_member.php?id=(.*) profile/$1 [R]

但是没有运气。

谢谢!

编辑

添加了当前的 .htaccess 文件

RewriteEngine on
RewriteCond $1 !^(index\.php|public|user_guide|files|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]


<ifModule mod_headers.c>
    Header set Access-Control-Allow-Origin: *
</ifModule>

【问题讨论】:

    标签: .htaccess


    【解决方案1】:
    RewriteEngine On
    RewriteRule ^profile/(.+)$ view_member.php?id=$1
    

    【讨论】:

    • 感谢您的回复,但它得到了我的内部服务器错误。我编辑了我的主要帖子以显示我当前的 .htaccess
    【解决方案2】:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^profile/(.*)$ view_member.php?id=$1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-06-05
      • 1970-01-01
      • 2021-06-22
      • 1970-01-01
      • 2021-04-10
      • 2016-11-22
      • 2014-02-12
      相关资源
      最近更新 更多