cancel
Showing results for 
Search instead for 
Did you mean: 

Rewrite - what, where, how?! (updated)

strangecharm
Newbie
Posts: 4
Registered: 03-01-2009

Rewrite - what, where, how?! (updated)

Morning,
I've been sent here by Plusnet's support department to find out how to do something with my ccgi space.  I've been told I need a "rewrite", but not what it is, where to find it or how to implement it.
Simply put, I have a blog on my ccgi space in a directory.  I have a domain now pointing to my ccgi space...but I want it to go straight to the blog directory.
Help much appreciated, even if its just point me somewhere else...
Thanks,
Philip
UPDATE : Following instructions from http://community.plus.net/forum/index.php/topic,46224.0.html, amoungst other posts, I've got an .htaccess file in the root of my ccgi space which contains:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.qwerty.org.uk$ [nc]
RewriteRule (.*) /qwerty/$1
(where qwerty is the name of the domain and the directory on the ccgi server).
I get a 500 server error though...  Sad
Help?!
8 REPLIES
Ben_Brown
Grafter
Posts: 2,839
Registered: 13-06-2007

Re: Rewrite - what, where, how?! (updated)

The problem with the rule that you have is that the condition is still true after the request has been rewritten, so it gets written again and again and again until apache notices it's an infinite loop and bombs out.
mod_rewrite is a bit confusing, and there's more than one way of doing most things, but this is one way which should work:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.qwerty.org.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/qwerty/ [NC]
RewriteRule (.*) /qwerty/$1
strangecharm
Newbie
Posts: 4
Registered: 03-01-2009

Re: Rewrite - what, where, how?! (updated)

Ben,
Thanks for the info.  Since putting up the update I've found out about my mistake and corrected it, thanks to the post of another member of Plusnet staff (RamiDoodle).
I'm still having trouble though.  Not sure if its a DNS thing, or that I've got the wrong Ipstag (should it be/also be ns1.plusnet.co.uk etc)?
DNS settings are currently:
Left field                  Type        Pri          Right field
neuron.org.uk.    a                            84.92.1.4
                                mx        20          mx.last.plus.net.
www                  cname                    ccgi.plus.net
Ipstag:
ns1.force9.net
ns2.force9.net
Community Gaffer
Community Gaffer
Posts: 12,959
Thanks: 749
Fixes: 69
Registered: 04-04-2007

Re: Rewrite - what, where, how?! (updated)

The IPSTAG is fine as it is and your DNS records look in order. I'm guessing that you've only recently updated your DNS records and it's taking a while to propagate.

Bob Pullen
Plusnet Products Team
If I've been helpful then please give thanks ⤵

Ben_Brown
Grafter
Posts: 2,839
Registered: 13-06-2007

Re: Rewrite - what, where, how?! (updated)

DNS looks fine for me, but I've had a quick look at your .htaccess and it has a lot of strange characters in it, as well as the rewrite stuff.
How did you get it up there? did you use SSH/telnet to type it in or did you use FTP or another client?
Whatever it is it seems to have corrupted your file, probably best to remove it from the server and add it in again.
edit: I've worked it out - your .htaccess file is in Rich-Text format, when it needs to be in plain text. If you're on Windows then use a text editor like notepad (should be in your accessories) to create your .htaccess file, rather than wordpad/word or similar.
strangecharm
Newbie
Posts: 4
Registered: 03-01-2009

Re: Rewrite - what, where, how?! (updated)

Ben
You were right - it was RTF.  I'm using a Mac and TextEdit defaults to RTF.  I've changed things around now and, using Cyberduck I've transferred the new .htaccess file to the root of my ccgi space.  I chmod'd the file to 755. 
Now I have a new problem.  Smiley
I don't get a 500 error now, but a 403:
Forbidden
You don't have permission to access / on this server.
I knew I couldn't point my DNS to a subdirectory of the ccgi space, but previously I have the domain pointing to the ccgi root ok - it brought up a directory listing.  As I understand it, the mod_rewrite is supposed to reside where it does, in the root, and redirect the domain request to the subdirectory, neatly side-stepping the problem of being unable to point the DNS directly.
So whats going on?  I've obviously done something wrong!
Soon as this is sorted I'm writing a nice forum post to help out other people who want to do this!
Thanks for reading and any help!
Philip
ramidoodle
Grafter
Posts: 265
Registered: 28-09-2008

Re: Rewrite - what, where, how?! (updated)

Hi,
I can see that you have 2 open tickets with regards to the .htaccess problem you are having.. I had a look at it, but it will be easier for me to edit it, if you are oki with resetting the password for ccgi to your default member centre login detail Smiley
So, I'll be able to have a look at this for you, however I need to reset your cgi login details to the default user/pass for the member centre, would that be ok?
strangecharm
Newbie
Posts: 4
Registered: 03-01-2009

Re: Rewrite - what, where, how?! (updated)

Fine with me!
THanks for the help.  It's _really_ appreciated.  Smiley
Philip
ramidoodle
Grafter
Posts: 265
Registered: 28-09-2008

Re: Rewrite - what, where, how?! (updated)

Sorted Smiley