【问题标题】:Replacing link with .htaccess用 .htaccess 替换链接
【发布时间】:2013-07-12 21:15:51
【问题描述】:

我正在尝试替换链接,但以内部服务器错误结束

www.domain.com/profile.php?id=1 

我想要它->

www.domain.com/1

.htaccess

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^login\.php\/?(.*)$ "http\:\/\/domain\.com\/$1" [R=301,L]

RewriteRule ^([^/]*)$ /profile.php?id=$1 [L]

【问题讨论】:

  • 第 4 行永远无法工作,因为您无法匹配后面的部分?与重写规则。为此,您可以使用 RewriteCond like in this Question
  • 谢谢我正在尝试:)

标签: .htaccess


【解决方案1】:

你只需要使用这个代码:

RewriteEngine on
RewriteRule ^([0-9]+)$ /profile.php?id=$1 [L]

【讨论】:

  • 让我在服务器上检查一下 :)
猜你喜欢
  • 2018-12-20
  • 2014-09-20
  • 1970-01-01
  • 2018-03-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多