301 Issues with 2 URLs on same webspace
up vote
1
down vote
favorite
I have 2 domains, the old domain is mjvandco.co.uk and he wants this redirecting to mjvlaw.co.uk. I have both pointing to the same webspace but when I test the URLs using https://httpstatus.io/ I get different results.
I have the following in my htaccess along with other stuff, but this is the redirect content:
RewriteEngine on
RewriteCond %HTTP_HOST !^www.mjvlaw.co.uk
RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]
# Remove .html (excluding blog)
RewriteCond %REQUEST_URI !^/blog(.*)$
RewriteCond %THE_REQUEST ^[A-Z]3,9 /.*.html HTTP/
RewriteRule ^(.*).html$ /$1 [R=301,L]
The only URL that now is not right is this one: http://www.mjvlaw.co.uk/. I used this site
https://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
http://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
http://www.mjvlaw.co.uk - not work as does not go to https
https://www.mjvlaw.co.uk - fine
However, when I do the same for the old domain it all works as it should and every one below goes too https://www.mjvlaw.co.uk.
https://www.mjvandco.co.uk
https://mjvandco.co.uk
http://mjvandco.co.uk
http://www.mjvandco.co.uk
Am I doing something stupid here? Should I create another webspace and have one folder for the old domain and what for the current one and each having it's own htaccess file?
Thanks. I have done another ticket a month or so back but I am not sure how to change the questions, so I apologise for the similar ticket.
apache .htaccess redirect
add a comment |
up vote
1
down vote
favorite
I have 2 domains, the old domain is mjvandco.co.uk and he wants this redirecting to mjvlaw.co.uk. I have both pointing to the same webspace but when I test the URLs using https://httpstatus.io/ I get different results.
I have the following in my htaccess along with other stuff, but this is the redirect content:
RewriteEngine on
RewriteCond %HTTP_HOST !^www.mjvlaw.co.uk
RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]
# Remove .html (excluding blog)
RewriteCond %REQUEST_URI !^/blog(.*)$
RewriteCond %THE_REQUEST ^[A-Z]3,9 /.*.html HTTP/
RewriteRule ^(.*).html$ /$1 [R=301,L]
The only URL that now is not right is this one: http://www.mjvlaw.co.uk/. I used this site
https://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
http://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
http://www.mjvlaw.co.uk - not work as does not go to https
https://www.mjvlaw.co.uk - fine
However, when I do the same for the old domain it all works as it should and every one below goes too https://www.mjvlaw.co.uk.
https://www.mjvandco.co.uk
https://mjvandco.co.uk
http://mjvandco.co.uk
http://www.mjvandco.co.uk
Am I doing something stupid here? Should I create another webspace and have one folder for the old domain and what for the current one and each having it's own htaccess file?
Thanks. I have done another ticket a month or so back but I am not sure how to change the questions, so I apologise for the similar ticket.
apache .htaccess redirect
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have 2 domains, the old domain is mjvandco.co.uk and he wants this redirecting to mjvlaw.co.uk. I have both pointing to the same webspace but when I test the URLs using https://httpstatus.io/ I get different results.
I have the following in my htaccess along with other stuff, but this is the redirect content:
RewriteEngine on
RewriteCond %HTTP_HOST !^www.mjvlaw.co.uk
RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]
# Remove .html (excluding blog)
RewriteCond %REQUEST_URI !^/blog(.*)$
RewriteCond %THE_REQUEST ^[A-Z]3,9 /.*.html HTTP/
RewriteRule ^(.*).html$ /$1 [R=301,L]
The only URL that now is not right is this one: http://www.mjvlaw.co.uk/. I used this site
https://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
http://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
http://www.mjvlaw.co.uk - not work as does not go to https
https://www.mjvlaw.co.uk - fine
However, when I do the same for the old domain it all works as it should and every one below goes too https://www.mjvlaw.co.uk.
https://www.mjvandco.co.uk
https://mjvandco.co.uk
http://mjvandco.co.uk
http://www.mjvandco.co.uk
Am I doing something stupid here? Should I create another webspace and have one folder for the old domain and what for the current one and each having it's own htaccess file?
Thanks. I have done another ticket a month or so back but I am not sure how to change the questions, so I apologise for the similar ticket.
apache .htaccess redirect
I have 2 domains, the old domain is mjvandco.co.uk and he wants this redirecting to mjvlaw.co.uk. I have both pointing to the same webspace but when I test the URLs using https://httpstatus.io/ I get different results.
I have the following in my htaccess along with other stuff, but this is the redirect content:
RewriteEngine on
RewriteCond %HTTP_HOST !^www.mjvlaw.co.uk
RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]
# Remove .html (excluding blog)
RewriteCond %REQUEST_URI !^/blog(.*)$
RewriteCond %THE_REQUEST ^[A-Z]3,9 /.*.html HTTP/
RewriteRule ^(.*).html$ /$1 [R=301,L]
The only URL that now is not right is this one: http://www.mjvlaw.co.uk/. I used this site
https://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
http://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
http://www.mjvlaw.co.uk - not work as does not go to https
https://www.mjvlaw.co.uk - fine
However, when I do the same for the old domain it all works as it should and every one below goes too https://www.mjvlaw.co.uk.
https://www.mjvandco.co.uk
https://mjvandco.co.uk
http://mjvandco.co.uk
http://www.mjvandco.co.uk
Am I doing something stupid here? Should I create another webspace and have one folder for the old domain and what for the current one and each having it's own htaccess file?
Thanks. I have done another ticket a month or so back but I am not sure how to change the questions, so I apologise for the similar ticket.
apache .htaccess redirect
apache .htaccess redirect
asked Nov 10 at 13:05
ChrisD
175
175
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You rule only redirects non-www
http URLs to SSL version of your site. To redirect both non-www
and www
http versions , replace your first rewrite block with the following
RewriteCond ℅HTTPS off [OR]
RewriteCond %HTTP_HOST !^www.mjvlaw.co.uk
RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]
Make sure to clear your browser cache before you test this.
this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
– ChrisD
Nov 11 at 11:15
@ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the℅HTTPS
variable. Try replacing the first condition withRewriteCond ℅REQUEST_SCHEME http$ [OR]
– starkeen
Nov 11 at 14:13
unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
– ChrisD
Nov 11 at 18:37
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You rule only redirects non-www
http URLs to SSL version of your site. To redirect both non-www
and www
http versions , replace your first rewrite block with the following
RewriteCond ℅HTTPS off [OR]
RewriteCond %HTTP_HOST !^www.mjvlaw.co.uk
RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]
Make sure to clear your browser cache before you test this.
this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
– ChrisD
Nov 11 at 11:15
@ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the℅HTTPS
variable. Try replacing the first condition withRewriteCond ℅REQUEST_SCHEME http$ [OR]
– starkeen
Nov 11 at 14:13
unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
– ChrisD
Nov 11 at 18:37
add a comment |
up vote
0
down vote
You rule only redirects non-www
http URLs to SSL version of your site. To redirect both non-www
and www
http versions , replace your first rewrite block with the following
RewriteCond ℅HTTPS off [OR]
RewriteCond %HTTP_HOST !^www.mjvlaw.co.uk
RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]
Make sure to clear your browser cache before you test this.
this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
– ChrisD
Nov 11 at 11:15
@ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the℅HTTPS
variable. Try replacing the first condition withRewriteCond ℅REQUEST_SCHEME http$ [OR]
– starkeen
Nov 11 at 14:13
unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
– ChrisD
Nov 11 at 18:37
add a comment |
up vote
0
down vote
up vote
0
down vote
You rule only redirects non-www
http URLs to SSL version of your site. To redirect both non-www
and www
http versions , replace your first rewrite block with the following
RewriteCond ℅HTTPS off [OR]
RewriteCond %HTTP_HOST !^www.mjvlaw.co.uk
RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]
Make sure to clear your browser cache before you test this.
You rule only redirects non-www
http URLs to SSL version of your site. To redirect both non-www
and www
http versions , replace your first rewrite block with the following
RewriteCond ℅HTTPS off [OR]
RewriteCond %HTTP_HOST !^www.mjvlaw.co.uk
RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]
Make sure to clear your browser cache before you test this.
answered Nov 10 at 14:14
starkeen
29.7k145777
29.7k145777
this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
– ChrisD
Nov 11 at 11:15
@ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the℅HTTPS
variable. Try replacing the first condition withRewriteCond ℅REQUEST_SCHEME http$ [OR]
– starkeen
Nov 11 at 14:13
unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
– ChrisD
Nov 11 at 18:37
add a comment |
this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
– ChrisD
Nov 11 at 11:15
@ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the℅HTTPS
variable. Try replacing the first condition withRewriteCond ℅REQUEST_SCHEME http$ [OR]
– starkeen
Nov 11 at 14:13
unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
– ChrisD
Nov 11 at 18:37
this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
– ChrisD
Nov 11 at 11:15
this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
– ChrisD
Nov 11 at 11:15
@ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the
℅HTTPS
variable. Try replacing the first condition with RewriteCond ℅REQUEST_SCHEME http$ [OR]
– starkeen
Nov 11 at 14:13
@ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the
℅HTTPS
variable. Try replacing the first condition with RewriteCond ℅REQUEST_SCHEME http$ [OR]
– starkeen
Nov 11 at 14:13
unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
– ChrisD
Nov 11 at 18:37
unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
– ChrisD
Nov 11 at 18:37
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239243%2f301-issues-with-2-urls-on-same-webspace%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown