Page 1 of 1
Page Properties - SEO
Posted: Fri Apr 22, 2022 6:34 pm
by mixextra
Hi,
the web contains a file htaccess that does the function:
http to https
www to non www
.html to non html extension
http://www.example.com/index.html
to
https://example.com/index
How to set the following parameters correctly - for example, for the "index" page:
1. Page Properties/SEO/Canonical URL ?
URL: ???
2. Page Properties/SEO/hreflang ?
The website is in one language SK (Slovakia)
Language: SK
URL: ???
Thanx
Re: Page Properties - SEO
Posted: Fri Apr 22, 2022 8:06 pm
by Pablo
I am not a SEO expert, but I don't think that you will need to set hreflang, if you only have one language.
Re: Page Properties - SEO
Posted: Sat Apr 23, 2022 7:34 am
by mixextra
and in the Page Properties / SEO / Canonical URL question, will anyone be able to advise me on whether the settings for the "index" page will be correct:
http://www.example.com/index.html
or
https://example.com/index
or
other
due to redirection of the htaccess file
Thank you for the advice and ideas
Re: Page Properties - SEO
Posted: Sat Apr 23, 2022 12:03 pm
by Pablo
Re: Page Properties - SEO
Posted: Sat Apr 23, 2022 1:23 pm
by wwonderfull
mixextra wrote: Sat Apr 23, 2022 7:34 am
and in the Page Properties / SEO / Canonical URL question, will anyone be able to advise me on whether the settings for the "index" page will be correct:
http://www.example.com/index.html
or
https://example.com/index
or
other
due to redirection of the htaccess file
Thank you for the advice and ideas
the canonical url usually for example my website with ssl it was
https://example.com if it did not have ssl certificate it would be
http://example.com without the "
s" that is the canonical url you should put to declare to search engines like google and others that you prefer the non-www version of your domain over the www version. But there is a cache. You need to config your .htaccess also for that which you can learn some configure by reading from here
https://www.askapache.com/htaccess/
Note: Why remove www from your domain and redirect to non-www?
Non-www domains are easy to remember and simpler to type and search for, which is great for getting direct traffic. This is the clearest, strongest benefit. Most people search for websites without typing the www, so eventually, the www domains might phase out, and non-www might be more prominent. And also google sees the www version and the non www version as duplicate content so you may get penalty for that too.
Re: Page Properties - SEO
Posted: Sat Apr 23, 2022 1:29 pm
by wwonderfull
Also note that depending on servers and settings the .htaccess codes can varry which I have gotten codes from others. One more tip I can give is that in robot.text file also put the exact canonical url. If you can not config the .htaccess then refrain from doing things half way.
Re: Page Properties - SEO
Posted: Sun Apr 24, 2022 10:41 am
by mixextra
Thank you for the direction, advice and ideas.
I will share my server settings and the WWB tool
https://www.seobility.net/en/seocheck/ evaluates as correct.
Server (Apache) and htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example.com$
RewriteRule ^(.*)$
http://example.com/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)/?$ /$1.html [L]
RewriteCond %{THE_REQUEST} \s/([^.]+)\.html [NC]
RewriteRule ^ /%1 [NE,L,R]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)/?$ /$1.php [L]
RewriteCond %{THE_REQUEST} \s/([^.]+)\.php [NC]
RewriteRule ^ /%1 [NE,L,R]
This setting ensures routing:
from
http://www.example.com/contact.html to
https://example.com/contact
or
from
http://www.example.com/contact.php to
https://example.com/contact
WWB canonical URL setting is:
https://example.com/contact
I'm still working on the correct settings for the homepage
https://example.com/index because google search engine indexes as homepage
https://example.com/ and listed as a duplicate page and incorrect setting of WWB canonical URL
https://example.com/index if I get to the home page from the WWB menu as an internal link to the page /index.html
So far, it seems to me to be a good solution in navigating the home page menu to use the External Web Address directly
https://example.com/ and setting WWB canonical URL
https://example.com/ this will ensure that
https://example.com/index is always redirected to the URL
https://example.com/ that google indexes and is also set to canonical in WWB.
Re: Page Properties - SEO
Posted: Sun Apr 24, 2022 1:20 pm
by wwonderfull
It should be more like example.com/page I think if you have used the removal code for the .html and .php then that should do it
Re: Page Properties - SEO
Posted: Mon Apr 25, 2022 3:08 pm
by mixextra
HI wwonderfull
my file listed above htaccess does not add / at the end (after the page title)
therefore, the notation is a canonical URL for WWB:
https://example.com/cookies
https://example.com/blog
when i added the end of the canonical URL for WWB / so SEO tool
https://www.seobility.net/en/seocheck/ reported an error
"The specified canonical link points to a different page."
The situation is different at the home page where / must be
therefore, the notation is a canonical URL for WWB:
https://example.com/
and appears in the browser window as
https://example.com
https://example.com/ I have listed it as a direct link in all navigation menus that link to the home page.
maybe there is a better solution but SEO tool
https://www.seobility.net/en/seocheck/ evaluates it as a correct solution without duplicate pages.
However, I have a problem with a page that contains a form or EditableContentAdmin and if htaccess removes the .php extension from the page,
so form and EditableContentAdmin do not work.
Re: Page Properties - SEO
Posted: Mon Apr 25, 2022 4:24 pm
by wwonderfull
mixextra wrote: Mon Apr 25, 2022 3:08 pm
HI wwonderfull
my file listed above htaccess does not add / at the end (after the page title)
therefore, the notation is a canonical URL for WWB:
https://example.com/cookies
https://example.com/blog
when i added the end of the canonical URL for WWB / so SEO tool
https://www.seobility.net/en/seocheck/ reported an error
"The specified canonical link points to a different page."
The situation is different at the home page where / must be
therefore, the notation is a canonical URL for WWB:
https://example.com/
and appears in the browser window as
https://example.com
https://example.com/ I have listed it as a direct link in all navigation menus that link to the home page.
maybe there is a better solution but SEO tool
https://www.seobility.net/en/seocheck/ evaluates it as a correct solution without duplicate pages.
However, I have a problem with a page that contains a form or EditableContentAdmin and if htaccess removes the .php extension from the page,
so form and EditableContentAdmin do not work.
Try
https://seositecheckup.com/ this is much better seo checker and one of the top best. I did my settings the way I had told but everything works for me. I even removed the .html and .php extension which comes after the page name. For me personally the form works 100% without the .php form page works although I removed the .php extension using .htaccess code. I will experiment using "Editable Content Admin" on my website and see what I can come up with. If it has any problem or something. I will try to let you know.
Re: Page Properties - SEO
Posted: Mon Apr 25, 2022 7:47 pm
by mixextra
wwonderfull, if you are willing can you share your htaccess settings?
/ at the end of the URL I see on many sites but so far I have not been able to get any commands to add my Apache server to the end of the URL /
as a bigger problem i see that php cms and forms scripts don't work for me
when I remove .php extensions
Maybe your settings could point me in the right direction.
Thanks
Re: Page Properties - SEO
Posted: Tue Apr 26, 2022 4:04 am
by wwonderfull
You can try and see the settings from here.
https://alexcican.com/post/how-to-remov ... -htaccess/
You can also try this to remove the .php
Code: Select all
RewriteEngine on
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [NC,L]
Even if that does not work there are countless many codes here
https://stackoverflow.com/questions/402 ... h-htaccess
Note: That the codes do the same thing although maybe written differently. It does the same thing.
Re: Page Properties - SEO
Posted: Wed Apr 27, 2022 2:08 pm
by wwonderfull
One more thing I found out is that you should not use the .php or .html extension on the canonical url if you have put removal code in .htaccess, so remember that or the seo will get messed up.
Google has the example I am talking about. See below
https://developers.google.com/search/do ... icate-urls
For the easiest understanding if you want in google to show your website as example.com/page the canonical url should also be example.com/page
modern seo discourage trailing / at the end so rules are updating day by day most people care about their websites content more the the duplicate links.
Re: Page Properties - SEO
Posted: Wed Apr 27, 2022 9:44 pm
by mixextra
Hi wwonderfull ,
thanks again for the ideas and recommendations
It goes without saying that when redirecting page non .html and non .php must be canonical URL WWB
http://example.com/page
I was able to solve all my problems, I will list my htaccess settings with a description:
Code: Select all
RewriteEngine On
RewriteBase /
#1. redirects everything from www to non www
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
#2. redirects everything from http to https
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#3. redirects everything from example.com/index.html and example.com/index.php and example.com/index to example.com/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index(\.(html?|php))?\ HTTP/ [NC]
RewriteRule ^((?:[^/]+/)*)index(\.(html?|php))?$ /$1 [R=301,L,NC,NE]
#4. redirects everything from example.com/page.html to example.com/page
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)/?$ /$1.html [L]
RewriteCond %{THE_REQUEST} \s/([^.]+)\.html [NC]
RewriteRule ^ /%1 [NE,L,R]
#5. redirects everything from example.com/page.php to example.com/page and work php form script and cms WWB
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R=302,L,NE]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
this setting # 4 resolves routing from the site navigation menu and also routes from ... / index.php and ... / index.htm and ... / index directly to domain ... example.com/
this setting # 5 resolved the removal of the .php extension as well as broken php form scripts and cms
to understand it, it is necessary to get acquainted with the settings of the APACHE server in more detail
With this setting, all canonical URLs for each site are as follows:
WWB canonical URL index =
https://example.com/
WWB canonical URL contact =
https://example.com/contact
WWB canonical URL blog =
https://example.com/blog
and so on
301 redirects are SEO and google friendly and it is important to follow the order of the commands so that they are redirected as little as possible in the chain
im recommend a useful htaccess routing test tool:
https://www.serpworx.com/check-301-redirects/