- This topic is empty.
-
AuthorPosts
-
June 15, 2005 at 10:01 am #667132
Anonymous
Guestthanks Ken,
for us real challenged, can you explain where that code should be inserted?
for example, should it go on our index page? all pages?
and does it go in the head section? (I assume).
please add any other info I need to know and probably don’t.

thanks again
S.
June 15, 2005 at 11:13 am #667137Anonymous
InactiveGo to your hosting CP – Website Settings – Custom Settings (Apache Config), or if you have acces to your .htaccess – just add this commands.
June 15, 2005 at 6:38 pm #667159Anonymous
InactiveI realized when I posted this that I wasn’t giving all the information really necessary. The reason was that I knew the way I installed it on my system would be different from virtually everyone else, and I wasn’t sure about how to install it for everyone else.
(I run Plesk on my server, so I installed this in /home/httpd/vhosts/domain.com/conf/vhost.conf, and then had to run
/usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –vhost-name=)
But that’s only if you are running Plesk (a hosting control panel).vd752’s description of where to put it looks fine to me. For the htaccess solution, I believe the file must be named ‘.htaccess’ and placed in the root directory where your content resides. Someone please correct me if I’m wrong. I’m sure you can find more detailed instructions by Googling htaccess.
You’ll probably have to restart Apache afterwards for this to take effect.
June 15, 2005 at 9:10 pm #667161Anonymous
InactiveI think the coding above is incorrect. I think it’s redirecting from http://www.example.com to http://www.example.com. Someone double-check please? (It should, unless I misunderstand, redirect from http://example.com to http://www.example.com.)
June 15, 2005 at 10:32 pm #667166Anonymous
InactiveYes there is an error in that code.
This is what i have in my .htaccess file and it works fine.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]June 15, 2005 at 10:50 pm #667167Anonymous
InactiveBoth my example and cyclone’s will work.
In my example, note the exclamation mark in the RewriteCond lines.
The line RewriteCond %{HTTP_HOST} !^http://www.domain.com [NC]
means match anything that does NOT start with http://www.domain.comJune 15, 2005 at 11:42 pm #667169Anonymous
InactiveYours worked for me, Ken.
Thanks!!!
June 16, 2005 at 12:33 am #667170Anonymous
InactiveVery cool to know. Thanks.
BlackjackInfo wrote:Both my example and cyclone’s will work.
In my example, note the exclamation mark in the RewriteCond lines.
The line RewriteCond %{HTTP_HOST} !^http://www.domain.com [NC]
means match anything that does NOT start with http://www.domain.comJune 16, 2005 at 2:30 am #667173Anonymous
InactiveI guess there wasn’t an error then, i didnt know about exclamation mark.
June 16, 2005 at 1:56 pm #667183Anonymous
InactiveHi,
one quick question. Currently trying to install the code, but having some problems. Which parts of the code need to be edited?
RewriteEngine on
RewriteCond %{HTTP_HOST} !^http://www.domain.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.domain.com/$1 [R=301,L]
Only the domain name, or also anything else? Can I place this code anywhere in the .htaccess file, or does it have to be in a specific spot?
I’m still very new to this stuff!Thanks for your help,
burgi
June 16, 2005 at 2:45 pm #667187Anonymous
InactiveOk, I got it to work, but I used cyclone’s code because I was not able to get the other code to work (probably too stupid to get it done). lol
Thanks,
burgi
June 16, 2005 at 3:59 pm #667191Anonymous
Inactiveburgi82 wrote:Ok, I got it to work, but I used cyclone’s code because I was not able to get the other code to work (probably too stupid to get it done). lolThanks,
burgi
Same here.
June 21, 2005 at 8:15 pm #667335Anonymous
InactiveHi all,
I’ve been messing around with this .htaccess trick for about an hour now, and I can’t seem to get anything to happen. I tried the examples from both Ken and cyclone.
I go into my Control Panel, and then I go to the Website Files and Scripts section where I can edit the .htaccess file. I have two options: Add Rule, or Edit Manually. I selected Edit Manually so I could just copy and paste the code into the text box.
I pasted the code, changed the dummy URLs to my own URL, and then saved the file.
Now when I go and type my url in the address bar without the www, I expect it to redirect to the www version, but it doesn’t. Isn’t that what it’s supposed to do?
Any ideas on what I’m doing wrong here? Do I need to stop and restart the server or something?
Here are the exact two methods I tried:
[HTML]
[/HTML][HTML]RewriteEngine On
RewriteEngine on
RewriteCond %{HTTP_HOST} !^onlinepokercraze.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.onlinepokercraze.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^onlinepokercraze.com$ [NC]
RewriteRule ^(.*)$ http://www.onlinepokercraze.com/$1 [R=301,L][/HTML]Thanks guys.June 21, 2005 at 10:01 pm #667337Anonymous
InactiveYes, you’ll need to restart Apache for the change to take effect.
Hope that works for you.June 22, 2005 at 12:04 am #667340Anonymous
InactiveBlackjackInfo wrote:Yes, you’ll need to restart Apache for the change to take effect.
Hope that works for you.I must be doing something dumb here; I still can’t get it to work. I tried each of the two techniques again, and I stopped and restarted the server (presumably this includes Apache?) for each of the two methods. Unfortunately the non-www version still doesn’t redirect to the www version.Carpathia is my host — does anyone here use them, and has anyone been successful at setting up this .htaccess trick? Whatever I’m doing wrong is probably very simple and obvious; I just wish I knew what it was! :blush:
-
AuthorPosts