cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

URL Canonicalization test fail

Hi,

My Some urls are not passing the URL Canonicalization Test .kindly suggest me what to do.

Case :

Domain Name : https://www.romiyoescortservice.com/

If A am Putting This Code In .htaccess File Then its pass URL Canonicalization Test .But Others Urls Of This website is not Showing Https In Urls.

<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(romiyoescortservice\.com)(:80)? [NC]
RewriteRule ^(.*) https://www.romiyoescortservice.com/$1 [R=301,L]
order deny,allow

--------------------------------------------------------------------------------------------------

If A am Putting This Code In .htaccess File Then its Not pass URL Canonicalization Test .But Others Urls Of The website is Showing Https In Urls.

<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?romiyoescortservice\.com
RewriteRule ^(.*)$ https://www.romiyoescortservice.com/$1 [R,L]

 

 

 

 

So Kindly Suggest me the best code which covers both URL Canonicalization and Https .

Regards

Rocky Singh

1 ACCEPTED SOLUTION
Resolver III

In the second example, you're using $1, but you don't define it, you could use {REQUEST_URI} instead.

 

You can also have a look at this example  - https://simonecarletti.com/blog/2016/08/redirect-domain-http-https-www-apache/

- it does http->https and also adds/removes "www" from all requests

 

Cheerio

 

———

I've worked around (not only) SSL security for over 20 years in enterprises and startups. 

I am now running an HTTPS expiry management service KeyChest.net

 

I have used a lot of help from open-minded communities and I try to repay some of that help.

View solution in original post

1 REPLY 1
Resolver III

In the second example, you're using $1, but you don't define it, you could use {REQUEST_URI} instead.

 

You can also have a look at this example  - https://simonecarletti.com/blog/2016/08/redirect-domain-http-https-www-apache/

- it does http->https and also adds/removes "www" from all requests

 

Cheerio

 

———

I've worked around (not only) SSL security for over 20 years in enterprises and startups. 

I am now running an HTTPS expiry management service KeyChest.net

 

I have used a lot of help from open-minded communities and I try to repay some of that help.

View solution in original post