cancel
Showing results for 
Search instead for 
Did you mean: 

ccgi Webspace htaccess rewrite has stopped working

FIXED
Kiwi2
Grafter
Posts: 25
Thanks: 2
Fixes: 1
Registered: ‎01-11-2015

ccgi Webspace htaccess rewrite has stopped working

I have a ccgi webspace which I use for an external domain. In the \public folder of my webspace I have a .htaccess file that rewrites URLs for that domain to point at a sub-folder. All has been working well for several years, but around a week ago the htaccess file stopped redirecting requests. I have made no changes at my end.

 

I've since tried a few changes in htaccess but nothing seems to make it redirect the domain. Does anyone know if anything changed at the PlusNet end a week or so ago?

Webspace: ccgi.thekiwis.plus.com

Domain: scriptrehearser.com

 

5 REPLIES 5
Superuser
Superuser
Posts: 10,018
Thanks: 1,340
Fixes: 71
Registered: ‎06-04-2007

Re: ccgi Webspace htaccess rewrite has stopped working

Sorry, this doesn't provide a direct solution to the .htaccess rewrite problem you are experiencing but such rewrites still work for me.

Have you been able to verify that the .htaccess file is recognised and processed, eg by using it to set an environment variable?

David
Kiwi2
Grafter
Posts: 25
Thanks: 2
Fixes: 1
Registered: ‎01-11-2015

Re: ccgi Webspace htaccess rewrite has stopped working

Good thinking, I'll try that to see.

 

Also perhaps there's some way of echoing the incoming host domain to that I can check that hasn't changed for some reason.

Kiwi

Kiwi2
Grafter
Posts: 25
Thanks: 2
Fixes: 1
Registered: ‎01-11-2015

Re: ccgi Webspace htaccess rewrite has stopped working

This is very odd. When there is a file path after the host name, the htaccess rewrite operates as expected and fetches the page from the new folder. But when the file path is blank it doesn't, and fetches the file from the root folder. 

My cut down test .htaccess file contains:

 

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{HTTP_HOST} ^alpha\.scriptrehearser\.com 
RewriteRule (.*) http://ccgi.thekiwis.plus.com/rehearser/pub/$1 [P,R=301]

 

A request to: alpha.scriptrehearser.com/index.htm returns ccgi.thekiwis.plus.com/rehearser/pub/index.htm as expected. Any file or folder name appears to work correctly.

However a request to alpha.scriptrehearser.com with nothing following the domain name is not redirected and returns index.htm from the root folder, or 404 if it is not present in the root folder.

In the latter case either the htaccess file is not being processed, or the RewriteRule is not working. Any ideas?

P.S. I haven't tried setting an environment variable to see which of these it is as I don't know how to then check whether it has been set

 

 

Kiwi2
Grafter
Posts: 25
Thanks: 2
Fixes: 1
Registered: ‎01-11-2015

Re: ccgi Webspace htaccess rewrite has stopped working

Fix

This is now fixed, but I don't know why this made a difference. 

.htaccess was rewriting the URL correctly except when there was no page or resource name after the host name.  htaccess was still being processed, but the rewrite was not working.

I added the following line near the top of htaccess and it started working correctly:

DirectoryIndex index.htm

This tells the server that index.htm is the default page for this directory. But... it already knew that, as it was picking up the index.htm when the rewrite wasn't working. I hadn't made any changes to the website for months but it had suddenly stopped working. And now doing this makes it work again.

So I've no idea what's going on but adding this line made the redirect work correctly, in case this helps anyone else.

 

Plusnet Help Team
Plusnet Help Team
Posts: 15,096
Thanks: 4,657
Fixes: 779
Registered: ‎21-04-2017

Re: ccgi Webspace htaccess rewrite has stopped working

Sorry for the issues you've had with your webspace (and for the delayed staff response), but I'm glad to hear you've got it working again and thanks for posting the solution. Hopefully it'll help others in a similar situation.

If you need any further assistance, please feel free to let us know.

If this post resolved your issue please click the 'This fixed my problem' button
 Anoush Mortazavi
 Plusnet Help Team