Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Can this redirection can be done?  (Read 2467 times)

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Can this redirection can be done?
« on: June 20, 2008, 06:54:32 pm »

Hello hello..
I've suppressed "home URL" and I made a redirection using .htaccess:
Quote
RedirectPermanent /home http://www.mysite.fr/
But it gives this URL:
-http://www.mysite.fr/?category=home
Why so hostile Mr Apache?
I'ld like an URL such as:
-http://www.mysite.fr/

Is someone familiar with apache language who can help me with translation? ;D

Joost

  • Guest
Re: Can this redirection can be done?
« Reply #1 on: June 20, 2008, 07:32:41 pm »

What is it you try to achieve?
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: Can this redirection can be done?
« Reply #2 on: June 21, 2008, 02:51:24 pm »

I am not sure what you want to achieve either Sven but if you want to direct viewers from one domain to another... here is a very simple way to do it without changing any existing files on the domain that does the redirecting.

Directing Domain A visitors to Domain B
(without .htaccess changes)

1)  Create a new index.php file in a folder somewhere on your computer with this in it... and change my-domain-name.com to the name of the domain you are re-directing your visitors to.

Code: [Select]

<?php
/*------------------------------------------------------------
  Redirect script: June 20.08
  Redirect viewers to my-domain-name.com
------------------------------------------------------------*/
header("location:http://www.my-domain-name.com/");
exit;
?>



2)  In your re-directing domain... re-name any index.htm or index.php files so the server cannot locate them... to something like... index_XX.htm or index_XX.php.

3)  Upload your new index.php file into the domain root. This domain will now re-direct visitors to the domain you put in the file's header string.

Right now I have this same file in 5 domains directing all their visitors to a 6th domain. Works great.  :)

« Last Edit: June 21, 2008, 02:53:09 pm by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: Can this redirection can be done?
« Reply #3 on: June 21, 2008, 06:32:52 pm »

Good tip Doug I' had now in my records.

Sorry if I was chaotic in my explanations. All I wanted to know is why this .htaccess redirection to the domain creates such an url :-http://www.mysite.fr/?category=home

In fact I used Codie's Mod for homeless URL.
In Google's index I've these kinds old URL such as:-http://www.mysite.fr/home/mypage/
and now I have -http://www.mysite.fr/mypage/
but if I use the.htaccess code above it gives such URL:
-http://www.mysite.fr/?category=home/mypage/

If I want a neat URL (such as, -http://www.mysite.fr/mypage/) will I need a rewrite instruction with the redirection?

NB: If you still don't get it, forget it pals

Joost

  • Guest
Re: Can this redirection can be done?
« Reply #4 on: June 21, 2008, 07:28:44 pm »

Philippe,

The following code in .htaccess will tell Google there is no page on that specific location,

Redirect      410  /home/not-here.html
Redirect      410  /home/dirty-pictures/

Of course, the new location will be picked up by Google while browsing the site, if that hasn't been done already.


What's causing this?
Because sNews doesn't follow the protocol, Google is still trying to search for the old locations. sNews 1.6 performs a temporary redirect to page 404, leaving Google to think that:
- the page is temporary relocated
- The new temporary location cannot be found.
Confusing? That's what Google thinks too.

What you could do is the following
Look for line 483 (startup)
Code: [Select]
header('Location: '.db('website').'404/'); exit;
replace it with:
Code: [Select]
$categorySEF = '404';header('HTTP/1.1 404 Not Found');

@Doug,

I would only use this approach, if it cannot be done in .htaccess. And unless, you want Google to index the 'old' location, I would suggest to make it a permanent redirect (301).



Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Re: Can this redirection can be done?
« Reply #5 on: June 21, 2008, 11:04:06 pm »

@ Sven: Example of something that usually works fine for me without adding any index.php?... and all :
Code: [Select]
RewriteEngine On
# Put this as first and non-conditional rewrite
RewriteRule ^(.*/)home/?$ http://www.mysite.fr/ [R=301,L]


Same way You can write second one which will just cut /home/ out of more complex url as well. Have fun and take care ;)
Logged

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: Can this redirection can be done?
« Reply #6 on: June 22, 2008, 10:41:51 am »

Oh! boys. You made my day!
Codie, it has worked without: / as:
Quote
RewriteRule ^(.*)home/?$ http://www.mysite.fr/ [R=301,L]

Now I'm expecting to have only one URL  for one page instead of two URL in Google index.
In such case (having duplicate URL) Google gives ya a -30 (or -6o, -90,etc.) penalty said some SEO experts.
Others say Minus30 Google's penalty is myth. Nobody knows really in fact. Exept Google which doesn't communicate upon its filters.
Anyway this .htaccess redirection won't do any harm.

Have a nice sunday boys. 8)