ElkArte Community

General => Chit Chat => Topic started by: Jorin on February 11, 2015, 03:50:26 am

Title: redirect via .htaccess
Post by: Jorin on February 11, 2015, 03:50:26 am
Can anyone help me please? I changed some domains and want to use .htaccess to tell Google about it. So I made a file with this:

Code: [Select]
RewriteEngine On

Redirect 301 http://hybrid-piloten.de/4076/fahrbericht-vw-jetta-hybrid-2013 http://forum-alternative-antriebe.de/index.php/topic,4366.0.html
Redirect 301 http://hybrid-piloten.de/3966/fahrbericht-peugeot-508-hybrid4-2012/ http://forum-alternative-antriebe.de/index.php/topic,4380.0.html
Redirect 301 http://hybrid-piloten.de/3339/fahrbericht-toyota-yaris-hybrid-2012/ http://forum-alternative-antriebe.de/index.php/topic,4378.0.html
Redirect 301 http://hybrid-piloten.de/3223/fahrbericht-kia-optima-hybrid-2013/ http://forum-alternative-antriebe.de/index.php/topic,4386.0.html
Redirect 301 http://hybrid-piloten.de/2398/fahrbericht-peugeot-3008-hybrid4-2012/ http://forum-alternative-antriebe.de/index.php/topic,4387.0.html
Redirect 301 http://hybrid-piloten.de/2231/fahrbericht-honda-jazz-hybrid-2011/ http://forum-alternative-antriebe.de/index.php/topic,4383.0.html
Redirect 301 http://hybrid-piloten.de/2352/fahrbericht-toyota-prius-plug-in-hybrid-2012/ http://forum-alternative-antriebe.de/index.php/topic,4391.0.html
Redirect 301 http://hybrid-piloten.de/2100/fahrbericht-lexus-gs-450h-2012/ http://forum-alternative-antriebe.de/index.php/topic,4388.0.html
Redirect 301 http://hybrid-piloten.de/1504/fahrbericht-honda-cr-z-2010/ http://forum-alternative-antriebe.de/index.php/topic,4384.0.html
Redirect 301 http://hybrid-piloten.de/1148/fahrbericht-honda-insight-2012/ http://forum-alternative-antriebe.de/index.php/topic,4390.0.html
Redirect 301 http://hybrid-piloten.de/1463/fahrbericht-toyota-prius-2012/ http://forum-alternative-antriebe.de/index.php/topic,4381.0.html
Redirect 301 http://hybrid-piloten.de/526/lexus-ct-200h-2011/ http://forum-alternative-antriebe.de/index.php/topic,4389.0.html

Redirect 301 http://hybrid-piloten.de/uber-uns/ http://hybrid-piloten.de
Redirect 301 http://hybrid-piloten.de/impressum-und-kontakt/ http://forum-alternative-antriebe.de/index.php/topic,4463.0.html
Redirect 301 http://hybrid-piloten.de/nutzungsbedingungen/ http://forum-alternative-antriebe.de/index.php/topic,4427.0.html
Redirect 301 http://hybrid-piloten.de/rechtliche-hinweise/ http://forum-alternative-antriebe.de/index.php/topic,4427.0.html
Redirect 301 http://hybrid-piloten.de/werbung-bei-den-hybrid-piloten/ http://forum-alternative-antriebe.de/index.php/topic,4427.0.html

Two problems:

1. Till a few moments ago when browse to a link, for example http://hybrid-piloten.de/uber-uns/ the server made a .password file and the browser shows a login window. What?!?  :o

2. Now all links who direct to the new urls cannot be found (404 error message).

What is going wrong?!? I don't get it!
Title: Re: redirect via .htaccess
Post by: Spuds on February 11, 2015, 12:31:23 pm
Fun with server configs !

I have not used Apache in some time  O:-)  But I think the syntax for those should be as below, not sure if that will make a difference or not to be honest.

Code: [Select]
RewriteEngine On
Redirect 301 /4076/fahrbericht-vw-jetta-hybrid-2013 http://forum-alternative-antriebe.de/index.php/topic,4366.0.html
Thatas a permanent redirection as well, so if you are just testing, a 302 may be better.  Again not sure.

No idea why you are getting a password prompt, normally that's only if you have an .htaccess file with auth commands and a corresponding .htpasswd file




Title: Re: redirect via .htaccess
Post by: Jorin on February 11, 2015, 02:24:52 pm
Funny. A friend of mine told me exact the same code. But it leads to an "500 internal server error".
Title: Re: redirect via .htaccess
Post by: emanuele on February 11, 2015, 03:27:14 pm
I think Spuds is right, the first term should not have the http://domain_name.tld part.
I'm not sure about the first slash as well, so maybe:
Code: [Select]
RewriteEngine On
Redirect 301 4076/fahrbericht-vw-jetta-hybrid-2013 http://forum-alternative-antriebe.de/index.php/topic,4366.0.html

Last time I had to deal with redirects, something like that was suggested:
Code: [Select]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^hybrid-piloten\.de$ [NC]
RewriteRule (.*)$ http://forum-alternative-antriebe.de/$1 [R=301,L]
Though that doesn't do exactly what you want, because it would redirect:
http://hybrid-piloten.de/4076/fahrbericht-vw-jetta-hybrid-2013
to:
http://forum-alternative-antriebe.de/4076/fahrbericht-vw-jetta-hybrid-2013
:-\
Title: Re: redirect via .htaccess
Post by: Jorin on February 12, 2015, 01:00:53 am
Thanks, but that's not what I need, you're right. When there's no solution for my server error I have to live without redirections of the links to our articles. It's a shame.

Oh, I don't blame you for having no solution! That's not what I meant!  :-[
Title: Re: redirect via .htaccess
Post by: emanuele on February 12, 2015, 08:08:18 am
Did you also try with the first little change I posted to the version proposed by Spuds?
Title: Re: redirect via .htaccess
Post by: Jorin on February 13, 2015, 03:17:52 am
Yep, leads to an 404 no found error, as you can test yourself with this link:

http://hybrid-piloten.de/4076/fahrbericht-vw-jetta-hybrid-2013

I made an .htaccess file with:

Code: [Select]
RewriteEngine On
Redirect 301 4076/fahrbericht-vw-jetta-hybrid-2013 http://forum-alternative-antriebe.de/index.php/topic,4366.0.html

...and uploaded it into the folder where the domain is set to.
Title: Re: redirect via .htaccess
Post by: Spuds on February 13, 2015, 01:39:38 pm
If you remove that file, does http://hybrid-piloten.de/4076/fahrbericht-vw-jetta-hybrid-2013 work?  Whats at that page, index.html or something else?
Title: Re: redirect via .htaccess
Post by: radu81 on February 13, 2015, 02:11:54 pm
Quote from: Spuds – does http://hybrid-piloten.de/4076/fahrbericht-vw-jetta-hybrid-2013 work? 
no, it's not working for me
Title: Re: redirect via .htaccess
Post by: emanuele on February 13, 2015, 02:39:31 pm
Another one yo ucan try is:
Code: [Select]
RewriteEngine On
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^hybrid-piloten\.de$ [NC]
RewriteRule 4076/fahrbericht-vw-jetta-hybrid-2013 http://forum-alternative-antriebe.de/index.php/topic,4366.0.html [R=301,L]
Title: Re: redirect via .htaccess
Post by: Jorin on February 14, 2015, 02:55:15 am
Quote from: Spuds – If you remove that file, does http://hybrid-piloten.de/4076/fahrbericht-vw-jetta-hybrid-2013 work?  Whats at that page, index.html or something else?

No, doesn't work. How could it, the URL leads then to a file that isn't in the folder.

More information seems to be needed to understand my problem. So let's take a look in the past:

I had two wordpress blogs and a SMF. the two blogs were running with the domains hybrid-piloten.de and elektro-piloten.de and the SMF had a sub domain forum.hybrid-piloten.de.

Nowadays: Wordpress in connection with the used gallery sucked, so we changed the concept. We transferred all wordpress articles into ElkArte posts and deleted the two blogs. Instead I made a small html page to describe our offer and who we are. The problem is: What happens with links to our articles spread anywhere in the net?

So I decided to use redirections so these links should work in the future, but lead to the ElkArte posts. But this seems to be very difficult.  :o

Quote from: emanuele – Another one yo ucan try is:
Code: [Select]
RewriteEngine On
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^hybrid-piloten\.de$ [NC]
RewriteRule 4076/fahrbericht-vw-jetta-hybrid-2013 http://forum-alternative-antriebe.de/index.php/topic,4366.0.html [R=301,L]

Oh!  :o  This seem to work!