Now the last part ( that don’t work in my case (site appear unformated but good 301).
1— we rewrite www or non www to
http://www.YourSiteName.com/ and make it permanent
with:
Code:
RewriteCond %{HTTP_HOST} !^(www\.YourSiteName\.com)?$
RewriteRule (.*) http://www.YourSiteName.com/$1 [R=301,L]
2— We Rewrite root request to the index file in subfolder
with:
Code:
RewriteCond %{HTTP_HOST} !^(www\.YourSiteName\.com)?$
RewriteRule (.*) http://www.YourSiteName.com/$1 [R=301,L]
3— No this is the part where I have a mistake because the site is not retrieving the right path to the images, js and all.
Tell me if I’m right here: (maybe wrong here

)
I think that the problem come from the internal redirection.
a) I explain; External redirection (for the index.php and /or probably site pages are correctly handled by the rewrite so far.
b) But internal redirection from Joomla asking for images, js and all end-up to be wrong with the current condition and rules...
c) I see the 4 next Condition to be exception to the last rule that redirect ALL(other than root (already done) request to the subfolder.
Exception 1Code:
RewriteCond %{REQUEST_URI} !^/subfolder/
Plain English: If the URL end path don’t have the /subfolder/ in go to next rule
This seem to be logical as if you put the subfolder in the path it should go already to the right place
Exception 2 — Where the error is (I think)
# and is not a request that is always handled by a file
Code:
RewriteCond %{REQUEST_URI} !\.(png|gif|jpe?g|css|js|zip|txt)$
Plain English: If the URL end path don’t have the .png, .gif, .jpg .... in go to next rule
Here, I think you don’t want to rewrite those links to be sure that Joomla internal request for link to images, js and all keep their integrity and are real physical path.
I think the problem here is that I don’t include the right path to those files by omitting to indicate mod_rewrite that they are not in the root but in a subfolder.
To fix the problem I think I should add the right path, with the subfolder, to those file to become an exception to the final rule.
That will be my Rewrite Newbie shot at this...
My wild guess will be this modification to the condition
# and is not a request that is always handled by a file
Code:
RewriteCond %{REQUEST_URI} !^/subfolder/.\.(png|gif|jpe?g|css|js|zip|txt)$
Plain English: If the URL end path don’t have the /subfolder/anything.png, .gif, .jpg .... in go to next rule
Exception 3The 2 other exceptions make sure that the physical path to files and folder are not part of the rewrite
# and does not actually exist as a file or folder
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
The final rule.# rewrite the request to be handled by the folder
Code:
RewriteRule (.*) /subfolder/$1 [L]
Rewrite - Re-route RewriteRule Make a Back Reference Point matched string ( Any character . Match indefinite* ) /subfolder/ add precedent matched string $1 Last rule in this expression L
Plain English: Rewrite-Re-route any path after
http://www.YourSiteName.com Exept the above exception in the subfolder - Last rule
But I’m probably wrong ....