Site hosted in subfolder - can't remove folder name from URL

Permalink
A quick bit of background - client was going to host site, and after build complete decided they did not want to host, so we arranged alternative hosting and moved site. Seemed to be working fine but then hit a raft of 500 errors - service provider eventually fixed by moving database to the correct server (their error in installation).

The final step was to remove the subfolder from the URL, which I ran through various guides from this forum, and the usual .htaccess additions. The .htaccess is working to an extent, in that the site is available at the URL without the subfolder visible... trouble is all C5 links ie autonav still include the subfolder and so if clicked take you back to the URL with the subfolder visible.

Hosting provider have looked at it agreed it was an unusual issue and unable to provide any support.

I know base url used to be set via site.php but of course no longer available in C5.8

Anyone able to give any pointers to get this working?

.htaccess in hosting root folder (xxxxxxxx.xxx replaced with domain)
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^(www.)?xxxxxxx.xxx$ 
RewriteCond %{REQUEST_URI} !^/cms/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /cms/$1 
RewriteCond %{HTTP_HOST} ^(www.)?xxxxxxx.xxx$ 
RewriteRule ^(/)?$ cms/default.php [L]


.htaccess in sub folder (folder containing the site build)
# -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cms/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
# -- concrete5 urls end --
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !^cms
RewriteRule ^(.*)$ cms/$1 [L,QSA]

 
JohntheFish replied on at Permalink Reply
JohntheFish
Can you point the domain directly at the subfolder, rather than getting bogged down in .htaccess from the parent folder?
MarmaladeSoup replied on at Permalink Reply
In an ideal world yes, and we can with our other hosts, but they don't yet support c5.8 - the new host do not allow the ability to assign addon domains directly to the subfolder unfortunately
noogen replied on at Permalink Reply
SeanDevoy replied on at Permalink Reply
OK, this is a terrible kludge, but I think it could work.

In your .htaccess if the folder is present, force a redirect (rewriterule .. [R]) to the url without the folder. This will cause the browser to show to url without the folder.

Then in you .htaccess internally redirect to the url with the folder (rewriteule ... [PT]).

It's ugly and inefficient, but gets you there if you have no other choices.

Sean