ccgi Webspace htaccess rewrite has stopped working
FIXED- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Re: ccgi Webspace htaccess rewrite has stopped wor...
08-12-2018 10:30 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
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
Fixed! Go to the fix.
Re: ccgi Webspace htaccess rewrite has stopped working
09-12-2018 7:55 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
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?
Re: ccgi Webspace htaccess rewrite has stopped working
09-12-2018 10:39 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
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
Re: ccgi Webspace htaccess rewrite has stopped working
13-12-2018 10:51 PM - edited 14-12-2018 8:39 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
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
14-12-2018 6:42 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
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.
Re: ccgi Webspace htaccess rewrite has stopped working
14-12-2018 8:07 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
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.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Re: ccgi Webspace htaccess rewrite has stopped wor...