By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,137 Members | 2,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,137 IT Pros & Developers. It's quick & easy.

about a 301 redirection using modrewrite

P: n/a
Hi!

I was following the http://www.seomoz.org/articles/301-redirects.php
article, trying to do that with one of my test sites
I added this to the .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com.ar
RewriteRule ^/(.*) http://domain.com.ar/$1 [R=301,L]

but nothing change :(
So, if the user came from http://www.domain.com.ar it will be 301ed to
http://domain.com.ar

Or not? any idea?
TIA, and sorry for the bad english :)

--
Luciano A. Ferrer
la**************@SacaDMEgmail.com
http://relojurbano.com.ar .algún día volverás.

.... Uy el nervio estaba vivo...
May 4 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Luciano A. Ferrer wrote:
Hi!

I was following the http://www.seomoz.org/articles/301-redirects.php
article, trying to do that with one of my test sites
I added this to the .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com.ar
RewriteRule ^/(.*) http://domain.com.ar/$1 [R=301,L]

but nothing change :(
So, if the user came from http://www.domain.com.ar it will be 301ed to
http://domain.com.ar

Or not? any idea?
TIA, and sorry for the bad english :)


Try this instead:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com.ar
RewriteRule ^(.*) http://domain.com.ar/$1 [R=301,L]

Ie. without the slash ("/") in the RewriteRule search pattern.

--
Kim André Akerø
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
May 5 '06 #2

P: n/a

Luciano A. Ferrer wrote:
Hi!

I was following the http://www.seomoz.org/articles/301-redirects.php
article, trying to do that with one of my test sites
I added this to the .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com.ar
RewriteRule ^/(.*) http://domain.com.ar/$1 [R=301,L]

but nothing change :(
So, if the user came from http://www.domain.com.ar it will be 301ed to
http://domain.com.ar

Or not? any idea?
TIA, and sorry for the bad english :)

--
Luciano A. Ferrer
la**************@SacaDMEgmail.com
http://relojurbano.com.ar .algún día volverás.

... Uy el nervio estaba vivo...


You might also be able to use a short little JavaScript and a very
small page to redirect to the correct domain/host. An example follows:

/*Don't mind me leaving out a !DOCTYPE declaration*/
<html>
<body onLoad="window.location='domain.com.ar';">
</body>
</html>

This should use the location element of window to redirect the browser
to your other site. You could easily replace the 'window.location'
with 'location.href' if you want W3C validated code, but I personally
wouldn't care whether it is valid or not. As long as it runs, it is
perfectly okay.

I have the honor to remain your most humble and Ob't Sv't in our war
against the King.

--
Patrick Reilly
1st Coy.
Colonel Seth Warner's Regiment

May 5 '06 #3

P: n/a
..oO(pe********************@gmail.com)
You might also be able to use a short little JavaScript and a very
small page to redirect to the correct domain/host.


You are kidding, aren't you?

Micha
May 6 '06 #4

P: n/a
__/ [ pe********************@gmail.com ] on Friday 05 May 2006 20:34 \__

Luciano A. Ferrer wrote:
Hi!

I was following the http://www.seomoz.org/articles/301-redirects.php
article, trying to do that with one of my test sites
I added this to the .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com.ar
RewriteRule ^/(.*) http://domain.com.ar/$1 [R=301,L]

but nothing change :(
So, if the user came from http://www.domain.com.ar it will be 301ed to
http://domain.com.ar

Or not? any idea?
TIA, and sorry for the bad english :)

--
Luciano A. Ferrer
la**************@SacaDMEgmail.com
http://relojurbano.com.ar .algún día volverás.

... Uy el nervio estaba vivo...


You might also be able to use a short little JavaScript and a very
small page to redirect to the correct domain/host. An example follows:

/*Don't mind me leaving out a !DOCTYPE declaration*/
<html>
<body onLoad="window.location='domain.com.ar';">
</body>
</html>

This should use the location element of window to redirect the browser
to your other site. You could easily replace the 'window.location'
with 'location.href' if you want W3C validated code, but I personally
wouldn't care whether it is valid or not. As long as it runs, it is
perfectly okay.

I have the honor to remain your most humble and Ob't Sv't in our war
against the King.


Users will loathe it; Not all users have JS enabled/supported; Search
engines will not follow and obey the redirection and the list goes on.

JavaScript might be fine for a one-off re-direction of some page (yes, I
have a few for historical reasons), but all in all, JS is no alternative
to server-side (thus rather transparent) redirection.

Hope it helps,

Roy

--
Roy S. Schestowitz | "Computers are useless. They only solve problems"
http://Schestowitz.com | GNU/Linux ¦ PGP-Key: 0x74572E8E
7:25pm up 9 days 2:22, 15 users, load average: 3.96, 3.48, 2.09
http://iuron.com - next generation of search paradigms
May 6 '06 #5

P: n/a

Roy Schestowitz wrote:
__/ [ pe********************@gmail.com ] on Friday 05 May 2006 20:34 \__

Luciano A. Ferrer wrote:
Hi!

I was following the http://www.seomoz.org/articles/301-redirects.php
article, trying to do that with one of my test sites
I added this to the .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com.ar
RewriteRule ^/(.*) http://domain.com.ar/$1 [R=301,L]

but nothing change :(
So, if the user came from http://www.domain.com.ar it will be 301ed to
http://domain.com.ar

Or not? any idea?
TIA, and sorry for the bad english :)

--
Luciano A. Ferrer
la**************@SacaDMEgmail.com
http://relojurbano.com.ar .algún día volverás.

... Uy el nervio estaba vivo...


You might also be able to use a short little JavaScript and a very
small page to redirect to the correct domain/host. An example follows:

/*Don't mind me leaving out a !DOCTYPE declaration*/
<html>
<body onLoad="window.location='domain.com.ar';">
</body>
</html>

This should use the location element of window to redirect the browser
to your other site. You could easily replace the 'window.location'
with 'location.href' if you want W3C validated code, but I personally
wouldn't care whether it is valid or not. As long as it runs, it is
perfectly okay.

I have the honor to remain your most humble and Ob't Sv't in our war
against the King.


Users will loathe it; Not all users have JS enabled/supported; Search
engines will not follow and obey the redirection and the list goes on.

JavaScript might be fine for a one-off re-direction of some page (yes, I
have a few for historical reasons), but all in all, JS is no alternative
to server-side (thus rather transparent) redirection.

Hope it helps,

Roy

--
Roy S. Schestowitz | "Computers are useless. They only solve problems"
http://Schestowitz.com | GNU/Linux ¦ PGP-Key: 0x74572E8E
7:25pm up 9 days 2:22, 15 users, load average: 3.96, 3.48, 2.09
http://iuron.com - next generation of search paradigms


This is exactly why I am suggesting this as an alternative, not a
replacement. I'm sure that it would be more successful if one was to
use server-side redirection, but I find that one can do many things
multiple different ways, and this is one.

I have the honor to remain your most humble and Ob't Sv't in our war
against the King.

--
Patrick Reilly
1st Coy.
Colonel Seth Warner's Regiment

May 6 '06 #6

P: n/a
Kim André Akerø ha escrito lo siguiente el 05/05/2006 13:43:
Luciano A. Ferrer wrote:
Hi!

I was following the http://www.seomoz.org/articles/301-redirects.php
article, trying to do that with one of my test sites
I added this to the .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com.ar
RewriteRule ^/(.*) http://domain.com.ar/$1 [R=301,L]

but nothing change :(
So, if the user came from http://www.domain.com.ar it will be 301ed to
http://domain.com.ar

Or not? any idea?
TIA, and sorry for the bad english :)


Try this instead:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com.ar
RewriteRule ^(.*) http://domain.com.ar/$1 [R=301,L]

Ie. without the slash ("/") in the RewriteRule search pattern.


Thanks a lot Kim!

the / was wrong?
or is it there to make another thing?

--
Luciano A. Ferrer
la**************@SacaDMEgmail.com
http://relojurbano.com.ar .algún día volverás.

.... Uy el nervio estaba vivo...
May 7 '06 #7

P: n/a
pe********************@gmail.com wrote:
Roy Schestowitz wrote:
__/ [ pe********************@gmail.com ] on Friday 05 May 2006 20:34 \__
Luciano A. Ferrer wrote:
Hi!

I was following the http://www.seomoz.org/articles/301-redirects.php
article, trying to do that with one of my test sites
I added this to the .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain\.com.ar
RewriteRule ^/(.*) http://domain.com.ar/$1 [R=301,L]

but nothing change :(
So, if the user came from http://www.domain.com.ar it will be 301ed to
http://domain.com.ar

Or not? any idea?
TIA, and sorry for the bad english :)

--
Luciano A. Ferrer
la**************@SacaDMEgmail.com
http://relojurbano.com.ar .algún día volverás.

... Uy el nervio estaba vivo...
You might also be able to use a short little JavaScript and a very
small page to redirect to the correct domain/host. An example follows:

/*Don't mind me leaving out a !DOCTYPE declaration*/
<html>
<body onLoad="window.location='domain.com.ar';">
</body>
</html>

This should use the location element of window to redirect the browser
to your other site. You could easily replace the 'window.location'
with 'location.href' if you want W3C validated code, but I personally
wouldn't care whether it is valid or not. As long as it runs, it is
perfectly okay.

I have the honor to remain your most humble and Ob't Sv't in our war
against the King.

Users will loathe it; Not all users have JS enabled/supported; Search
engines will not follow and obey the redirection and the list goes on.

JavaScript might be fine for a one-off re-direction of some page (yes, I
have a few for historical reasons), but all in all, JS is no alternative
to server-side (thus rather transparent) redirection.

Hope it helps,

Roy


This is exactly why I am suggesting this as an alternative, not a
replacement. I'm sure that it would be more successful if one was to
use server-side redirection, but I find that one can do many things
multiple different ways, and this is one.

I have the honor to remain your most humble and Ob't Sv't in our war
against the King.


Using server-side redirection -- with the 301 code -- will help stop
search engine bots from indexing a page at the "undesired" URL.
Instead, the bots will index only at the desired URL. Scripts will not
do this.

--
David E. Ross
Climate: California Mediterranean
Sunset Zone: 21 -- interior Santa Monica Mountains with some ocean
influence (USDA 10a, very close to Sunset Zone 19)
Gardening pages at <http://www.rossde.com/garden/>
May 7 '06 #8

P: n/a
__/ [ David E. Ross ] on Sunday 07 May 2006 20:12 \__
pe********************@gmail.com wrote:
Roy Schestowitz wrote:
__/ [ pe********************@gmail.com ] on Friday 05 May 2006 20:34 \__

Luciano A. Ferrer wrote:
> Hi!
>
> I was following the http://www.seomoz.org/articles/301-redirects.php
> article, trying to do that with one of my test sites
> I added this to the .htaccess file:
>
> RewriteEngine On
> RewriteCond %{HTTP_HOST} !^domain\.com.ar
> RewriteRule ^/(.*) http://domain.com.ar/$1 [R=301,L]
>
> but nothing change :(
> So, if the user came from http://www.domain.com.ar it will be 301ed to
> http://domain.com.ar
>
> Or not? any idea?
>
>
> TIA, and sorry for the bad english :)
>
> --
> Luciano A. Ferrer
> la**************@SacaDMEgmail.com
> http://relojurbano.com.ar .algún día volverás.
>
> ... Uy el nervio estaba vivo...
You might also be able to use a short little JavaScript and a very
small page to redirect to the correct domain/host. An example follows:

/*Don't mind me leaving out a !DOCTYPE declaration*/
<html>
<body onLoad="window.location='domain.com.ar';">
</body>
</html>

This should use the location element of window to redirect the browser
to your other site. You could easily replace the 'window.location'
with 'location.href' if you want W3C validated code, but I personally
wouldn't care whether it is valid or not. As long as it runs, it is
perfectly okay.

I have the honor to remain your most humble and Ob't Sv't in our war
against the King.
Users will loathe it; Not all users have JS enabled/supported;
Search
engines will not follow and obey the redirection and the list goes
on.

JavaScript might be fine for a one-off re-direction of some page (yes,
I
have a few for historical reasons), but all in all, JS is no
alternative to server-side (thus rather transparent) redirection.

Hope it helps,

Roy


This is exactly why I am suggesting this as an alternative, not a
replacement. I'm sure that it would be more successful if one was to
use server-side redirection, but I find that one can do many things
multiple different ways, and this is one.

I have the honor to remain your most humble and Ob't Sv't in our war
against the King.


Using server-side redirection -- with the 301 code -- will help stop
search engine bots from indexing a page at the "undesired" URL.
Instead, the bots will index only at the desired URL. Scripts will not
do this.


That is absolutely true, but for a single page, the loss may be tolerable.
Moreover, in certain circumstances (personal examples I can think of), the
effect of 'flickering' or somehow 'preparing' the user for the actual page
can be complementary and cheap. One of my hosts gives me no access to the
site other than FTP (it's BDS-based), so management of the site is harder.
That's why I started JS redirects in the first place. I replaces none sin-
ce.

With kind regards,

Roy

--
Roy S. Schestowitz
http://Schestowitz.com | Free as in Free Beer ¦ PGP-Key: 0x74572E8E
4:30pm up 10 days 23:27, 9 users, load average: 1.10, 0.95, 0.99
http://iuron.com - semantic engine to gather information
May 8 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.