473,386 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

about a 301 redirection using modrewrite

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
8 2505
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

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
..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
__/ [ 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

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
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
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
__/ [ 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael Shestero | last post by:
Hello. General description of my knotty problem: I have a code (a function f) on standart C++ that perform some smart action. This code works as console application getting user input from...
8
by: Alexander Widera | last post by:
hi, perhaps you all know ModRewrite for the apache webserver... Is there an equivalent for asp.net / iis? I don't want to buy a component (.dll)... I want to program it myself. Some time ago, I...
0
by: Don | last post by:
Is it possible to configure an application to use CodeBase and Redirection (Config file) to load the latest version of an Assembly from a specified URL. Using Codebase i need to specify the exact...
2
by: Don | last post by:
Is it possible to configure an application to use CodeBase and Redirection (Config file) or any other means, to load the latest version of an Assembly from a specified URL. Using Codebase i need...
1
by: comp.lang.php | last post by:
require_once("/users/ppowell/web/php_global_vars.php"); if ($_GET) { // INITIALIZE VARS $fileID = @fopen("$userPath/xml/redirect.xml", 'r'); $stuff = @fread($fileID,...
4
by: psual | last post by:
hi newbie in web design I got some issue concerning a secure redirection between 2 pages let say I have a page with a grid (the 'master' page) in this grid I can select a record, get its pk...
3
by: postindex | last post by:
Can I get whole commandline not only argument list. 1. When I command like this $ a.py filename 2. sys.argv is returns only argument list Is there a way to find out 'redirection'...
13
by: Massimo Fabbri | last post by:
Maybe it's a little OT, but I'll give it try anyway.... I was asked to maintain and further develop an already existing small company's web site. I know the golden rule of "eternal" URIs, but...
0
dlite922
by: dlite922 | last post by:
I need help with redirecting virtualhosts to use HTTPS (SSL) when they type in HTTP Must work in IE. Right now there is two virtual host blocks for every subdomain. I want to combine the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.