Forum Moderators: phranque

Message Too Old, No Replies

Primary Domain in a subdirectory .issues

         

orasis

7:40 pm on Dec 2, 2010 (gmt 0)

10+ Year Member



Hi, my first post here, greets everyone, and thanks for any help in advance.

I've been messing with the following for some weeks but I would need some help with an issue if someone can. I have setup the primary domain on a host to point to a subdirectory of public_html using various of methods, I will show 2 of those that both work great except a small issue.


Method 1:
I entered the following code in the /public_html/.htaccess file:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/__subdirectory
RewriteRule ^(.*)$ /__subdirectory/$1 [L]



Method 2:
I entered the following code in the /public_html/.htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteCond %{REQUEST_URI} !^/__subdirectory/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /__subdirectory/$1
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ __subdirectory/index.php [L]



so, ..in /__subdirectory/ I got a Joomla installation (with SEF urls enabled) and any of the above methods works, except that if I enter in the url this: [domain.com...] (images directory exists), then the url becomes [domain.com...]

In a way this exposes the subdirectory name on url, and am not sure what other this might cause especially concerning seo. To solve this I thought of forcing to always add a trailing slash at the end of every url using the following code before the above:

RewriteCond %{REQUEST_URI} !(\.|/$)
RewriteRule (.*) http://www.domain.com/$1/ [R=301,L]


This way the /__subdirectory/ went away from the url, but now I cannot use a very cool feature of the SEF component that I use on a lot on sites called “Aliases” feature. They just don't work.

I have been searching on google to find a way to remove the /__subdirectory/ from the url but nothing worked so far. Any help would be greatly appreciated.


P.S
I got a question on this too, later I plan to add an ssl to the primary domain, will all this cause problems with the ssl etc ?

Thanks a lot
cheers

jdMorgan

1:43 am on Dec 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You will need to check through all of the .htaccess files and look at all of the Joomla code, and make sure that no external redirects can be done after the request is rewritten to the /_subdirectory path.

Only an external redirect can "expose" your internally-rewritten path, so something, somewhere is doing a redirect after your rewrites have been executed. That cannot be allowed.

Jim

orasis

9:27 pm on Dec 7, 2010 (gmt 0)

10+ Year Member



thanks for your reply and help jdMorgan, I temporarily found a way to make aliases work using the above codes. But you put me in thoughts and I will have to check it out deeper and come back to post.

So you think that the above codes should NOT expose the subdirectory name ? or I missed something in those codes ?

cheers