Advice on URL names - Q from SEO course


(Marian Wosnitza) #21

… the last one had a backslash before the two dots, which got erased somehow.


(scott williams) #22

I would look I. Your hosting Cpanel (or whatever dashboard you have) and see if there is a redirect facility built in. Most have this, it will write the proper code into the .hraccess for you.


(Doug Bennett) #23

First drop the quotes
Second try using something like this

Redirect 301 /oldpage.html https://www.yoursite.com/newpage.htm

You must use a complete path.


(Marian Wosnitza) #24

Will check with my provider. Thanks anyway.


(Marian Wosnitza) #25

Drop quotes and complete path didn’t work either. Thanks much.


(Don H) #26

A link to your website would be helpful.

I leave off the index.html or index.php from the destination and just point it to the folder, just like if I was setting up a link to that page.


(Marian Wosnitza) #27

This is it:


(Don H) #28

Here’s how I would write the redirect:

redirect 301 /solutions/embedded-solutions.html https://www.carnica-technology.com/embedded-project-tools/

That should work, unless there is something odd in the server setup or htaccess file. Make sure that anything in the htaccess file is plain text. If you paste anything in, make sure you paste as plain text.

I also noticed that I am not getting a padlock icon on your site. You likely still have http links instead of all https links on your pages. You can’t call non-SSL (http) content from an SSL (https) page. It’s referred to as mixed content and since not all the content is secure, you do not get the padlock. Here’s a site to help track down those mixed-content issues. https://www.whynopadlock.com


(Marian Wosnitza) #29

You are right. I have not reviewed all pages and changed all http: to https:
They are still mixed. Perhaps this will help.

Your suggestion for the redirect is also not working.
For my provider, the syntax looks like to be different.
I have to check with them.

BTW, Redirect has to have a capital R.
Thanks anyway for your help.


(Don H) #30

Probably good practice, but my redirects work fine with it lowercase.

Hopefully, your provider can provide the proper syntax.


(Doug Bennett) #31

If you’re not running Apache(or nginx with a converter) then using a .htaccess file probably won’t work.
The format for a redirect with an htaccess file should work if your host supports htaccess. Some host do restrict htacces file use.

You did not say who the host you are using is. That might help as someone on the forum may have experience with them.


(Marian Wosnitza) #32

My provider is 1&1 IONOS AG, www.ionos.at


(Doug Bennett) #33

I’m not familiar with them but they appear to support .htaccess.

Perhaps you can post here the complete .htaccess file you are using?

Once you paste it into your post select it and mark it as code(select the </> above) if you’re failing the test tool I gave above then it’s not going to work on the live site.


(Marian Wosnitza) #34

Here is the relevant part of my .htaccess file.
Line 5 and 6 work.
301 Redirects in line 13 to 16 are all trying the same with different syntax - None worked.
Here is the file:

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

############################################################
#     301-Umleitung      #
############################################################
Options +FollowSymlinks
RewriteEngine On  
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^(.*)$ https://www.my-site.com/$1 [R=301,L]

#######################################################################
#     404-Umleitung auf Fehlerseite      #
#######################################################################

AuthGroupFile /dev/null
AuthName Intern
AuthType Basic
ErrorDocument 404 https://www.my-site.com/errorpage/errorpage.html

#######################################################################
#     Umleitung /index.html und /index.php auf Rootseite      #
#######################################################################

RewriteEngine On
RewriteRule ^index\.(php|html)$ https://my-site.com/ [R=301,L]

############################################################
#     301-Umleitung auf index.html/php Seiten Nov2018     #
############################################################

Redirect 301 "/solutions-overview/solutions-overview.html" "/solutions-overview/index.html"
Redirect 301 /solutions-overview/solutions-overview.html /solutions-overview/index.html
Redirect 301 ^/solutions-overview/solutions-overview.html$ /solutions-overview/index.html
RewriteRule ^/solutions-overview/solutions-overview.html$ /solutions-overview/index.html [R=301,L]

(Jan Fuellemann) #35

You did exchange “my-site” with your real Website Address?


(Doug Bennett) #36

I hope that is not your real .htaccess file, as has been pointed out by Jan (@Fuellemann) you have issues.

You have a lot going on in the file, .htaccess files can have conflicts so a rule may never get hit. Without seeing the actual file in its entirety, it would be impossible to determine what is going on. You can either post the actual file, along with what you are trying to do and a URL to the site or start with an empty .htaccess file add the rewrite rules one at a time and by process of elimination determine the conflict.

For example, you have RewriteEngine On twice, you should group all the rewrite together. You are redirecting files from index.html to index.php? Why?
If the files name has changed in an earlier directive, then later rules may not be applied.


(Marian Wosnitza) #37

Here is my real .htaccess file.

I corrected the double RewriteEngine ON, and the redirect from index.html to .php - which was in there forever, don’t know where it came from. Thanks for the hints.

There are many more similar redirect lines on more pages, which I left out.
The syntax of the redirect line can be any of the ones mentioned in my previous post - they all don’t work.

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php

AuthGroupFile /dev/null
AuthName Intern
AuthType Basic
ErrorDocument 404 https://www.carnica-technology.com/errorpage/errorpage.html

Options +FollowSymlinks
RewriteEngine On  
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^(.*)$ https://www.carnica-technology.com/$1 [R=301,L]

Redirect 301 "/solutions/embedded-solutions.html" "/embedded-project-tools/index.html"
Redirect 301 "/solutions-overview/solutions-overview.html" "/solutions-overview/index.html"

(Doug Bennett) #38

Why are you using php 5? Active support drooped almost 2 years ago, security support goes away in about a month. If you have a need for it you really need to migrate to something else.

Not sure why you have this, most shared hosting don’t give you access to create symbolic links, if they need it (for hosting needs) they have that directive further up the Apache food chain.

That being said, I would remove that stuff, and put the redirect at the top of my htaccess file.

RewriteEngine On
Redirect 301 /solutions/embedded-solutions.html /embedded-project-tools/index.html
Redirect 301 /solutions-overview/solutions-overview.html /solutions-overview/index.html
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
AuthGroupFile /dev/null
AuthName Intern
AuthType Basic
ErrorDocument 404 https://www.carnica-technology.com/errorpage/errorpage.html

Edited (had a pasting error)


(Anne Bourdon) #39

In this part of your htaccess file, I would have written the full URL for the new destination : https://www.carnica-technology.com/embedded-project-tools/index.html, instead of only embedded-project-tools/index.html


(Marian Wosnitza) #40

The php5 stuff was in there for years. Can’t remember where it came from. You are probably right to take it out.
I also took out the “Options…” line.
Putting the redirects at the top does not work either.
This is really complex…