admin管理员组文章数量:1130349
This is a Wordpress related question, because the problem came from a multi-install Wordpress. But it's also related to serverside, with .htaccess
My problem is : when a user type my URL without WWW, it get him/her to an submission URL, inviting him/her to log-in. From to an URL like this .php?new=mister-tea.fr instead of
I really don't want it, I just want that the user is redirected to the same domain, and the same URL with WWW.
My main domain is (Fr website)
The rule could work :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^fixie-lille.fr$
RewriteRule (.*) /$1 [R=301,L]
</IfModule>
But it breaks other website.
I tried using some rules in .htaccess, but does not seems to work. All my websites use WWW domains and are not available without WWW.
Beside that, I use this rule to redirect user between http and https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Does the following rule could have a bad interference ?
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
Beside that, everything works fine wtih several Wordpress in just one install.
Thanks per advance, I'm at your disposal to answer further questions
This is a Wordpress related question, because the problem came from a multi-install Wordpress. But it's also related to serverside, with .htaccess
My problem is : when a user type my URL without WWW, it get him/her to an submission URL, inviting him/her to log-in. From https://mister-tea.fr to an URL like this https://www.fixie-lille.fr/wp-signup.php?new=mister-tea.fr instead of https://www.mister-tea.fr
I really don't want it, I just want that the user is redirected to the same domain, and the same URL with WWW.
My main domain is https://www.fixie-lille.fr (Fr website)
The rule could work :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^fixie-lille.fr$
RewriteRule (.*) https://www.fixie-lille.fr/$1 [R=301,L]
</IfModule>
But it breaks other website.
I tried using some rules in .htaccess, but does not seems to work. All my websites use WWW domains and are not available without WWW.
Beside that, I use this rule to redirect user between http and https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Does the following rule could have a bad interference ?
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
Beside that, everything works fine wtih several Wordpress in just one install.
Thanks per advance, I'm at your disposal to answer further questions
Share Improve this question asked Jun 25, 2018 at 10:20 Arthur CamberleinArthur Camberlein 134 bronze badges1 Answer
Reset to default 0Since you have multiple domains you can't include the domain in the redirect itself to create a one-size-fits-all generic redirect (which is what I assume you are trying to do). You also need to ensure that the directives are in the correct order.
Since all your sites use the www subdomain then try the following instead. However, this assumes you don't have any other subdomains.
RewriteEngine On
# non-www to www (and HTTPS)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) https://www.%{HTTP_HOST}/$1 [R=301,L]
# HTTP to HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# WordPress directives follow...
The non-www to www redirect now tests if the requested host does not start www. And if not, simply prepends it.
No need to repeat the RewriteEngine directive and no need for the <IfModule mod_rewrite.c> wrappers on your custom directives.
With regards to your HTTP to HTTPS redirect, there's no need to capture the RewriteRule pattern if it is not being used in the substitution. ie. When using %{REQUEST_URI} instead of a backreference.
As always, clear your browser cache before testing.
This is a Wordpress related question, because the problem came from a multi-install Wordpress. But it's also related to serverside, with .htaccess
My problem is : when a user type my URL without WWW, it get him/her to an submission URL, inviting him/her to log-in. From to an URL like this .php?new=mister-tea.fr instead of
I really don't want it, I just want that the user is redirected to the same domain, and the same URL with WWW.
My main domain is (Fr website)
The rule could work :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^fixie-lille.fr$
RewriteRule (.*) /$1 [R=301,L]
</IfModule>
But it breaks other website.
I tried using some rules in .htaccess, but does not seems to work. All my websites use WWW domains and are not available without WWW.
Beside that, I use this rule to redirect user between http and https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Does the following rule could have a bad interference ?
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
Beside that, everything works fine wtih several Wordpress in just one install.
Thanks per advance, I'm at your disposal to answer further questions
This is a Wordpress related question, because the problem came from a multi-install Wordpress. But it's also related to serverside, with .htaccess
My problem is : when a user type my URL without WWW, it get him/her to an submission URL, inviting him/her to log-in. From https://mister-tea.fr to an URL like this https://www.fixie-lille.fr/wp-signup.php?new=mister-tea.fr instead of https://www.mister-tea.fr
I really don't want it, I just want that the user is redirected to the same domain, and the same URL with WWW.
My main domain is https://www.fixie-lille.fr (Fr website)
The rule could work :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^fixie-lille.fr$
RewriteRule (.*) https://www.fixie-lille.fr/$1 [R=301,L]
</IfModule>
But it breaks other website.
I tried using some rules in .htaccess, but does not seems to work. All my websites use WWW domains and are not available without WWW.
Beside that, I use this rule to redirect user between http and https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Does the following rule could have a bad interference ?
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
Beside that, everything works fine wtih several Wordpress in just one install.
Thanks per advance, I'm at your disposal to answer further questions
Share Improve this question asked Jun 25, 2018 at 10:20 Arthur CamberleinArthur Camberlein 134 bronze badges1 Answer
Reset to default 0Since you have multiple domains you can't include the domain in the redirect itself to create a one-size-fits-all generic redirect (which is what I assume you are trying to do). You also need to ensure that the directives are in the correct order.
Since all your sites use the www subdomain then try the following instead. However, this assumes you don't have any other subdomains.
RewriteEngine On
# non-www to www (and HTTPS)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) https://www.%{HTTP_HOST}/$1 [R=301,L]
# HTTP to HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# WordPress directives follow...
The non-www to www redirect now tests if the requested host does not start www. And if not, simply prepends it.
No need to repeat the RewriteEngine directive and no need for the <IfModule mod_rewrite.c> wrappers on your custom directives.
With regards to your HTTP to HTTPS redirect, there's no need to capture the RewriteRule pattern if it is not being used in the substitution. ie. When using %{REQUEST_URI} instead of a backreference.
As always, clear your browser cache before testing.
本文标签: multisiteURL without www redirect directly with submission pageMultiwordpress install
版权声明:本文标题:multisite - URL without www redirect directly with submission page - Multiwordpress install 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749024691a2304917.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论