PDA

View Full Version : The Redirect 301 saga


vinnyvangogh
03-26-2015, 03:40 AM
My hosting is with 1&1 Uk - what was called shared hosting - is now called a virtual server. Its a Linux platform - but the main "engine" is Apache.
No cPanel - no access to the rewrite module.

Support ( a loose term!) say Apache is set at default - which means my server will run a .htaccess file with a Redirect 301/.

The website being rebuilt - originated around 2003 made by a "professional studio" and I suppose for the day - it was as good as there was.
I took over around 2004/5 and kept the same structure and page names and just rebuilt the lot with new content. 3 times over the years.

To comply with Google media friendly "Responsive" website - which it was until the mandate changed to cater for "smartphones" so it was time for a rebuild and new layouts.

The site had got bloated to 98 pages or so ( some already defunct)

The first page I tried to redirect is in the last of a nest of three folders.

I first tried redirect 301/oldfile.html newfile.html in the root - nothing
tried in the folder of the old file - nothing

Rapidtables.com have write tool and use full URLs I inserted the actual info.. took the code produced - pasted into the .htaccess - which uploads as htaccess.txt renamed in the server ( edit in Fetch 2) nothin worked.

I pestered 1&1 and eventually a server support reply offered full URLs - they had the the test site details and wrote to suit it... it worked!

OK, the full website was in a folder - on a domain which holds my wife's craft site. The .htaccess went into that folder.

Fine I have a solution! But using the same format I renamed the page and I tried another page - nothing.

Deciding I needed a domain to test rather than a folder in another domain... I purchased a .co.uk domain so the redirects if the worked in the beta files... would simply copy over its the clients server - also with 1&1!

So the .htccess Redirect 301/ path is Root - Products > Abits > Bbits/old.html
the redirect is to:- Root - Products > Cbits > Dbits/new.html

Nothing works!

At times if I placed the .htaccess in the root.. I would get an error 500 page.
Ditto at times if I placed in a folder.

To be frank.. I have tried so many options and codes generated online by tools or used their codes in Tips etc,.

Google Webmaster tools forum had two replies and neither functioned and one was from a guru in Adelaide Aus - who runs a website and has written code making tools. He is puzzled why nothing works.

So I contact 1&1 support - "its not within our support remit to supply code or information other than that relevant to our products".
Again the confirm that my server allows use of .htacces.

The only problem I saw was some folders and pages have space between titles is a flder might be "Abits 1960" No "_" pr "-" and page might be bits 1960.html looking at the supplied code, I saw that he/she had added %20 were the files had a space.
Idiot thought I and promptly looked in code view...not showing in code view.

I duplicated the page and renamed it - and in code view added the "%20"
Resulted in Error 500! I move the .htaccess from root to folders ann had the same results.

So, if having spaces is going to prevent a redirect and adding "%20" is in effect renaming the the and kills the path.... how is that "repaired."

No an added problem is i am not allowed to give the factual website or URLs.

I did this - like an idiot - on a webbies forum and my then boss - got inundated with emails offering quotes to build his website because I was asking them how to do it!

At the moment - unless I can get this sorted, I plan to simple leave the unwanted pages off any internal menus - add a no index no cache meta and put a text link to the new page for anybody who may have a link showing in Google webmaster "links to".

In all the forum's and websites with the ask question type forum inclining hosting companies _ I have not found anybody with the same question!

Does .htaccess run OK in an Apache driven Virtual server?

edbr
03-26-2015, 05:03 AM
post the comple4te .htaccess file here so wec can see , if you are getting 500 codes then it is working but contains errors i would say

edbr
03-26-2015, 05:19 AM
i point make sure there are no other htaccess files on the site incase there is an overide conflict

Ricky55
03-27-2015, 01:40 AM
a redirect should look like this

RewriteEngine On

redirect /old-file.html http://www.domain.co.uk/new-file.html

vinnyvangogh
03-27-2015, 03:54 AM
As seen in my post -

My hosting is with 1&1 Uk - what was called shared hosting - is now called a virtual server. Its a Linux platform - but the main "engine" is Apache.
No cPanel - no access to the rewrite module.

Support ( a loose term!) say Apache is set at default - which means my server will run a .htaccess file with a Redirect 301/.

So far no variation has "worked".

vinnyvangogh
03-27-2015, 04:11 AM
i point make sure there are no other htaccess files on the site incase there is an overide conflict

Just tries this version... not functioning.

The "company" does not exist. I have had the domain name for years after they closed down. I put some of their old information on a new
Responsive set of pages.

Used > company and process as folders holding the URLs
made it easier by using all lower case and no spaces or "-" or "_"

Redirect 301 /company/profile.html http://www.arco-studwelding.com/process/process.html

also tries full URLs

Redirect 301 /http://www.arco-studwelding.com/company/profile.html http://www.arco-studwelding.com/process/process.html

edbr
03-27-2015, 04:27 AM
post the whole page that you have (.htaccess)

vinnyvangogh
03-27-2015, 04:33 AM
thats it.. nothing works so no point adding to it !

The redirect sits in a .txt file no space at the top of page.

1 blank line under it. Not sure if delay in updating changes in server apply.. the last three different version all bring up Internal Server Error

Edit.. its renamed .htaccess on the server

edbr
03-27-2015, 04:42 AM
rewriteEngine on
Redirect 301 /company http://www.arco-studwelding.com/process/
should redirect the entire folder

edbr
03-27-2015, 04:45 AM
clearly .htaccess works if you are getting error. it is a mistake im the file for sure. make the file in notepad++ or similar save as .htaccess and upload using ftp, dont remname on site incase that is adding some hidden text

vinnyvangogh
03-27-2015, 04:56 AM
clearly .htaccess works if you are getting error. it is a mistake im the file for sure. make the file in notepad++ or similar save as .htaccess and upload using ftp, dont remname on site incase that is adding some hidden text

Tried that also... unless its the textEdit app on iMac - but it will not save and pops up... Names that begin with a dot . are reserved for the system - sense I upload as a .txt file and rename.
Will see if a change in app helps.

Edit: You say the redirect is "working'. Along the line 1&1 support have written a redirect - but the obviously did not try coz they never worked - but it raises the question why don't they know the correct format! (rhetorical)

vinnyvangogh
03-27-2015, 05:26 AM
Almost sussed it!!

Went to Rapidtables ( again ) they have a redirect code generator... which till now.. never worked.

But this did - Placed in root

Redirect 301 /company/profile.html http://www.arco-studwelding.com/process/process.html

its in place now and working! Now to fathom out why this functions and the other did not.

vinnyvangogh
03-28-2015, 09:21 PM
To conclude:
The Hosting company assured me that my Linux platform - Apache "main server" Virtual server would handle .htaccess redirects.
The saga of issues above suddenly cleared up and redirects written by me or generated by online "free tools" - suddenly started to function.

My opinion was that the real problem was due to the main Apache server - which "virtual server" accounts cannot access - did not have the re-write module activated.
They are never going to admit that - but I see no other explanation.

Everything seems OK now and again I offer my thanks for the help given here.

vinnyvangogh
03-29-2015, 10:36 PM
Hi Edbr - just to end this thread.

Typical of "support" every reply I made never went back to the person offering a failed solution. More than once I had asked if the Apache re-Write module had been activated on the main server which controlled my virtual server ( some call it shared hosting) each time the answer was its set at default. I reply... but without a cPanel to check... WHAT is default and have you checked the native module?
I have posts here, 1&1 .com (USA)forum, inMotion "comments" Google Webmaster tools forum, at least four other "help and support" type website websites none of which gained a reply and one wanted an annual subscription.
Because 301 redirects are basically a very simple line of code most of the replies offer the same information.
One of the mods on the Google forums runs a website that has free tools and he email me with info.. until he got fed up with nothing "working".
Having pestered 1&1 I asked for a supervisor or manager level person to contact me because I was tired of getting replies from different stuff and the "help" was conflicting with other "advice" already offered. However - one question was never accurately answered IS MY SERVER ABLE TO PROCESS .HTACCESS WITH THE DEFAULT APACHE SETTING I AM ADVISED APPLIES TO MY VIRTUAL SERVER.

Never answered as such and the reply indicated that offering code or scripts is not part of the support remit, however - my server is able to process .htaccess.

Why waiting for this reply - and taking into account on of your replies said... the redirect is working .....etc,. I typed in one the urls used in a redirect - it opened a search page on the top of which was.... WE HAVE MOVED THIS PAGE and below was a link to the "new" page!
To end this.... I wrote a new .htaccess and tested it.. two redirects were processed without a problem!

I cannot believe that everybody who offered advice or lines of code format etc,. were wrong and I had even checked the Apache server forum to check the Redirect 301 "convention" layout the redirect and where its placed.
I believe that the "default" setting on Apache does not have the reWrite module activated. Never having seen it, what I read indicates that using it to add code - effectively turns it on or within the UI is an On/Off "button".
Whatever the truth suddenly I can make redirects and not have any issues.

vinnyvangogh
04-25-2015, 06:02 AM
A better end to the redirect saga came when after a truckload of emails to "support" at 1&1 and a request that somebody with real technical knowledge about the servers and not a script reading if this - than that, call centre operator get involved. The result was a reply that stated the reason redirects had not functioned - was that the Apache module had been turned off "..by a faulty code submission"! I assume that was a leg smacking session for me to imply my fault. I responded by advising that some of the finest code writers and not a few pro websites which had redirect code generators had been involved..including...1&1.com in the USA!

They also supplied a script that went in the root and operates over all and any other "additional website" located in a folder in the root.

RewriteEngine On
RewriteBase /homepages/xxx/xxxxxxxxxxx/htdocs

Whatever is the truth in this saga... my redirects are functioning OK now..... for now.