httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Ray [Lists]" <li...@blazestudios.com>
Subject Re: [users@httpd] .htaccess issue with Apache 2.0.59
Date Thu, 28 Jun 2007 18:40:05 GMT
Well I got it working. I ended up having to do it like this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.nwdyc\.org [NC]
RewriteRule ^.* http://nwdyckids.tripod.com/ [R,L]

RewriteCond %{HTTP_HOST} ^nwdyc\.org [NC]
RewriteRule ^.* http://nwdyckids.tripod.com/ [R,L]

Making a separate condition for each URL variation.

John Schofield wrote:
> I'm no .htaccess expert -- I'm at the "I've read the docs and gotten a 
> few .htaccess rules working" stage. So take what I say with a grain of 
> salt.
>
> 1) You need to escape the periods in your regexes. It should be 
> ^www\.nwdyc\.org$, not ^www.nwdyc.org$.
>
> 2) Your rules will redirect traffic to ANY page at nwdyc.org to 
> nwdyckids.tripod.com. If that's what you want, fine. If you want to 
> redirect nwdyc.org/whatever to nwdyckids.tripod.com/whatever, you need 
> to do something else. You're using parenthesis to create a 
> backreference; you need to actually add the backreference back in, 
> like this: RewriteRule ^(.*)$ http://nwdyckids.tripod.com/$1
>
> 3) I don't know why your IP-based rewrite rule isn't working. I've 
> never played with that.
>
> 4) Here's the complete, working rewrite rule for my site, 
> blog.sudosu.net:
>
>> RewriteEngine On
>> RewriteBase /
>>
>> RewriteCond %{HTTP_HOST}   ^www\.blog\.sudosu\.net$
>> RewriteRule ^(.*)$         http://blog.sudosu.net/$1 [L,R=301]
>>
>> RewriteCond %{REQUEST_FILENAME} !-f
>> RewriteCond %{REQUEST_FILENAME} !-d
>> RewriteRule . /index.php [L]
>
>
> 5) Here are some notes:
>
>> RewriteCond %{HTTP_HOST}   ^www\.blog\.sudosu\.net$
>> RewriteRule ^(.*)$         http://blog.sudosu.net/$1 [L,R=301]
>
> The above cond and rule redirect any traffic to www.blog.sudosu.net 
> (because some people think EVERY URL needs a "www" in front of it) to 
> blog.sudosu.net. The L means don't evaluate any further rules in the 
> .htaccess. The "R=301" means this is a permanent redirect -- your 
> browser's addrss bar should show the new address, not the old, and 
> search engines should replace the old URL in their indexes with the 
> new URL. That may or may not be what you want.
>
>
> --JMS
>
>
>
>
>
> On Jun 28, 2007, at 10:59 AM, Tom Ray [Lists] wrote:
>
>> Well, DirectoryIndex works. So I'm assuming it is. I did put the 
>> gibberish in and I got a 500 error, so it's back to troubleshooting.
>>
>> John Schofield wrote:
>>> First thing I would try is putting gibberish in your .htaccess file, 
>>> and see if you get an error when you load pages in the directory 
>>> containing the gibberish .htaccess file. If you don't get an error, 
>>> Apache isn't loading your .htaccess file.
>>>
>>> If you DO get an error, you can take out the gibberish and continue 
>>> troubleshooting.
>>>
>>>
>>> --JMS
>>>
>>>
>>> On Jun 28, 2007, at 10:46 AM, Tom Ray [Lists] wrote:
>>>
>>>> Hey, I'm using Apache 2.0.59 and I'm running into a bit of an issue 
>>>> here. I just can't seem to get the RewriteEngine command to work in 
>>>> .htaccess. I can get the other .htaccess directives 
>>>> (DirectoryIndex, password, etc) to work but not this. I have 
>>>> mod_rewrite.c in my list when I do httpd -l so I'm assuming I have 
>>>> the module installed.
>>>>
>>>> Here are the two entries I've tried but can't seem to get working.
>>>>
>>>> Here I want to redirect anyone who types in that domain to the 
>>>> tripod site. (Client request)
>>>> RewriteEngine On
>>>> RewriteCond %{HTTP_HOST} ^nwdyc.org [NC]
>>>> RewriteCond %{HTTP_HOST} ^www.nwdyc.org [NC]
>>>> RewriteRule ^(.*)$ http://nwdyckids.tripod.com/ [R,L]
>>>>
>>>> Here I was just trying to make the damn thing see my IP address and 
>>>> move me over to yahoo.
>>>> RewriteEngine on
>>>> RewriteCond %{REMOTE_ADDR} ^221.216.69.25$
>>>> RewriteRule ^(.*)$ http://www.yahoo.com [L]
>>>>
>>>> Neither of these seem to work. Is there something I'm doing wrong?
>>>>
>>>> ---------------------------------------------------------------------
>>>> The official User-To-User support forum of the Apache HTTP Server 
>>>> Project.
>>>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> The official User-To-User support forum of the Apache HTTP Server 
>>> Project.
>>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server 
>> Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message