Mod_Rewrite on但不会更改URL布局

时间:2014-10-18 18:10:10

标签: php apache .htaccess url mod-rewrite

您好我通过.htaccess

重写我的网址时出现问题

Php信息: 服务器API CGI / FastCGI Hoster设置: Apache mod_rewrite ON

当前网址布局:

  

http://www.xxxx.at/beitrag.php?thema=Bitcoins%20fuer%20jedermann%20gratis

通缉:

  

http://www.xxxx.at/beitrag/Bitcoins%20fuer%20jedermann%20gratis(可以   我将%20更改为“ - ”也可能?)

我已经找到了一个看起来像这样的.htacces:

RewriteEngine On
RewriteRule (.*)_(.*)\.html$ /bitcoins.php?to=$1 [qsappend,L]

但是网址看起来仍然相同,没有任何改变。

是的,有人能帮帮我吗? 问候

1 个答案:

答案 0 :(得分:0)

尝试:

Options -Multiviews
RewriteEngine On

RewriteCond %{THE_REQUEST} \ /+beitrag\.php\?thema=([^&\ ]+)
RewriteRule ^ /beitrag/%1 [L,R]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^bietrag/(.+)$ /bietrag.php?thema=$1 [L]
  1. 关闭多重视图,以便/beitrag <{1}}不会抢先使用/beitrag.php
  2. 第一条规则匹配HTTP请求行,浏览查询字符串,并重定向浏览器以便新URL显示在位置栏中
  3. 第二条规则匹配新网址,并在内部将其重写回具有查询字符串的网址。
相关问题