Apache mod_rewrite добавление дополнительной наклонной черты в конце URL

Необходимо использовать версию Ubuntu CloneZilla. Это позволяет Вам копировать изображение своего диска к FTP-серверу или доле NetBios, всем от загрузочного диска EZ.

3
задан 22 November 2011 в 00:15
2 ответа

Since it's in your main config file, and not a per-directory ( or .htaccess), then the leading slash is not being stripped for context. It's actually adding (or trying to add - not sure if Apache's removing the extra in most cases, or if the client browser is) the second slash to every rewrite.

Just account for the fact that the leading slash is included in the string that you're matching:

RewriteRule ^/(.*)$ http://aaronjwood.com/$1 [R=301,L]
3
ответ дан 3 December 2019 в 05:16

Since it's directly in a vhost, here's the solution: remove the slash here: http://aaronjwood.com$1

Another tip: when alone, ^(.*)$ is the same as (.*).

So here's the solution:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.aaronjwood\.com$
RewriteRule (.*) http://aaronjwood.com$1 [R=301,L]

Please tell me if it worked.

Olivier

4
ответ дан 3 December 2019 в 05:16

Теги

Похожие вопросы