Страница 1 из 1

Регексп для mod rewrite

Добавлено: 2010-09-23 17:15:04
pithagora
Задачя перенаправить несколько доменов domain.info, domain.net, domain.de на domain.com. Проблема в том что регексп ниже перенаправляет все кроме https. Укажите пожалуйста как мне указать что нужно и https?

Код: Выделить всё

        RewriteCond %{HTTP_Host} ^(https?:\/\/)?(www\.)?domain\.info$ [NC]
        RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

        ## Redirect all http to https
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Re: Регексп для mod rewrite

Добавлено: 2010-09-23 18:30:47
ProFTP
cейчас разве не на https?

попробуй так:

Код: Выделить всё

        RewriteCond %{HTTP_Host} ^(http?s?:\/\/)?(www\.)?domain\.info$ [NC]
        RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

        ## Redirect all http to https
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
может еще так: :-D

Код: Выделить всё

        RewriteCond %{HTTP_Host} ^([http|https]?:\/\/)?(www\.)?domain\.info$ [NC]
        RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

        ## Redirect all http to https
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Код: Выделить всё

        RewriteCond %{HTTP_Host} ^((https?|http)?:\/\/)?(www\.)?domain\.info$ [NC]
        RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

        ## Redirect all http to https
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Код: Выделить всё

        RewriteCond %{HTTP_Host} ^([https?|http]?:\/\/)?(www\.)?domain\.info$ [NC]
        RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

        ## Redirect all http to https
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Re: Регексп для mod rewrite

Добавлено: 2010-09-24 11:24:10
pithagora
Задачя встала по другому

редиректнуть все url что содержит в теле слово например "mydomain" на mydomain.com

Re: Регексп для mod rewrite

Добавлено: 2010-09-24 13:46:09
pithagora
вопшем щяс регексп стал таким

Код: Выделить всё

        RewriteEngine On
        RewriteCond %{HTTP_Host} !^www\.mydomain\.com$ [NC]
        RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R]

        ## Redirect all http to https
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
но https полюбому не редиректит