Advice on URL names - Q from SEO course

(Marian Wosnitza) #41

Tried this also. Full URL does not change it.
Still getting: This redirect was not followed.

(Doug Bennett) #42

Did you drop the quotes?
Full URL shouldn’t make any difference. Apache doesn’t care, it will redirect to the complete URL.

If you copy what I posted above it should work. Keep in mind you’re using 301’s which are permanent, meanings they have no expiry so they get cached. If you have an error going to a wrong place they might still go there.

Also are you sure you have the htaccess file in the correct place and with the correct name?

(Marian Wosnitza) #43

I tried it with and without quotes. Both versions did not work in htaccess tester.
My .htaccess file starts with:

RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^/(.*)$$1 [R=301,L]

as recommended by my provider. This actually works.
I also tried “RewriteRule ^…$ …” like the syntax above - does not work either.

The .htaccess file is in the root directory on FTP.

(Marian Wosnitza) #44

Since none of the redirects worked so far, I changes 301 to 302 on the FTP - just to be safe.

(Doug Bennett) #45

The one I provided above works great on the tester with your URL’s.
It also works great at redirects to https.
How are you adding to the htaccess file? What editor are you using?
Not sure what exactly is happening but the rules as provided should work unless you have other non disclosued items in your htaccess file.

File needs to be named .htaccess . Usually needs to be in the same directory as your home page.
Redirect’ are processed “top Down” so once a directive is matched it ends, the rest of processing isn’t processed until the request returns.

(Marian Wosnitza) #46

I tried it with just one single line in my htaccess file and put this line in the tester:

Redirect 302 “/solutions/embedded-solutions.html” “/embedded-project-tools/index.html”

It does not work. I get:
“This redirect was not followed.”

(Doug Bennett) #47

The post above I gave you has no quotes.

Drop the quotes

What URL’s are you testing?

I just tested this(with https) :

With the following:

Redirect 302 /solutions/embedded-solutions.html /embedded-project-tools/index.html

And got a good result:

The new url is
Test are stopped, a redirect will be made with status code 302

(Marian Wosnitza) #48

Tested this and it works.
Having a couple of dozens of pages I need to redirect, I assume I have to write the redirect line with full URL, both for source and for target.
Please confirm.
Thanks much.

(Marian Wosnitza) #49

Goodness. Just tired this with full URL - does not work.
How do I write now my many lines of redirects?

(Doug Bennett) #50

Don’t need full URL.

What I gave each time works - I tested it.

Just copy each line and change it. don’t add quotes, or anything.

If have any issues, included a complete version of the htaccess file.

(Marian Wosnitza) #51

If I write
in the request URL line, and below
Redirect 302 /solutions/embedded-solutions.html /embedded-project-tools/index.html
it works fine.

As soon as write more than one line below, like
Redirect 302 /solutions/embedded-solutions.html /embedded-project-tools/index.html
Redirect 302 /solutions-overview/solutions-overview.html /solutions-overview/index.html
Redirect 302 /company/company.html /company/index.html
it does not work. No matter if I enter
in the request URL line.
Putting RewriteEngine On before the redirects does not help either.

(Don H) #52

Are you talking about it not working in the htaccess tester with multiple redirects or on your website?

I went to the tester and the redirects work fine, even with all three added.

(Marian Wosnitza) #53

See screenshot. The syntax should be correct - according to my provider.

(Doug Bennett) #54

The URL you show in the post is the home page, not the page you want redirected.

Try changing the URL being tested to this:

You’re not getting any syntax error in the tester, but since you have no redirects for the URL it’s simply telling you that each rule wasn’t met.

(Marian Wosnitza) #55

Hi Doug,
I’m afraid we are running in circles.
I tested what you suggest - see my post from Dec 7th. This works fine.
But if I have several pages from different folders to redirect, what do I put into the URL line?
I can only redirect one page at a time.

(Don H) #56

When you are testing a specific page redirect (rule), you would put that page’s address in the url line in the tester. This mimics a user going to that page. The testers show what htaccess will do when a user tries to go to a specific page. If the url you put in does not have a redirect, the tester will show that the page will not be redirected. In other words, the user would go to the url as entered.

You need a rule line for each page you want to redirect. In the above test, you have redirects for two pages. If a user tries to go to either of those pages, they will be redirected by the appropriate rule line you have setup and instead of going to the page in the url line, they will go to the destination of the redirect rule.

(Doug Bennett) #57

Don (@DLH) nailed it.
The tester can have all your rules (redirects) in the htaccess part.

It will only test one URL at a time.

It works just like a real server in that it processes the directives top down one at a time. It gives the results fo each directive one at a time until it hits one that causes a redirect to occur. It then stops processing, just like a real htaccess file.

(Marian Wosnitza) #58

Now I understand. I thought the tester will be capable to test my entire file.
Testing one URL at a time works fine.
This was my fundamental misunderstanding.
Thanks for clarifying.
And thanks for your help.

(Doug Bennett) #59

No problem,
I would set up a “test script” that has a line with a link to each page you’re redirecting. Just a simple text file.

Put all the redirects in the tester, and one at a time paste each URL in and test it. Once you’re satisfied with the results, put the htaccess file into the server and. test live with each URL. If you setup the test script correctly it’s just as simple as clicking each entry and ensuring it redirects to the expected page.

By settings up a simple test script you can reuse and add to it as needed in the future. This gives you a good tool to regression test future changes.

(Marian Wosnitza) #60

I tested every redirect line by line. All worked fine in the tester.
The same lines in .htaccess had not only no effect, they caused a blank screen when the old URL was called.
I am in dialogue with the provider IONOS to find out what went wrong.
Will let you know when I make progress.