Susanne52
Susanne52

Reputation: 11

htaccess hide subfolder in all pages

I found similar topics, but not an answer working for me.

My htaccess is actually :

RewriteEngine on


# remove www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [NE,R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?publigraphix\.com$
RewriteRule !^Jomla_344french/ /Jomla_344french%{REQUEST_URI}  [L]/Jomla_344french%{REQUEST_URI}  [L]

With this, I can hide the subfolder in the url of my homepage, but it appears again by opening any page of my website.

How can I hide the subfolder in the url on all pages ?

Thank You for help, this is my first post. Greetings,

Susanne

Thanks for Your help. Now my htaccess is like this : RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?publigraphix.com$ RewriteCond %{THE_REQUEST} /Jomla_344french/(.*)\sHTTP [NC] RewriteRule ^ /%1 [NE,L,R] RewriteCond %{HTTP_HOST} ^(www.)?publigraphix.com$ RewriteRule !^Jomla_344french /Jomla_344french%{REQUEST_URI} [NC,L]

For the homepage, this works fine, but in the subpages, the url displays /index.php/ with an 404 error (for example url shows : publigraphix.com/index.php/tampons instead of publigraphix.com/tampons ...) Do You have an idea?

Upvotes: 1

Views: 277

Answers (1)

Amit Verma
Amit Verma

Reputation: 41249

To hide the subfolder ,you can use

RewriteEngine on


# remove www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [NE,R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?publigraphix\.com$
RewriteCond %{THE_REQUEST} /Jomla_344french/(?:index\.php/)?(.*)\sHTTP [NC]

RewriteRule ^ /%1 [NE,L,R]
RewriteCond %{HTTP_HOST} ^(www\.)?publigraphix\.com$
RewriteRule ^((?!Jomla_344french).*) /Jomla_344french/index.php/$1  [NC,L]

Upvotes: 0

Related Questions