Passionate Engineer
Passionate Engineer

Reputation: 10412

.htaccess MOD_rewrite for the entire site

I have a site that is under www.domain/store

I want to get rid of store using MOD_rewrite for the entire site.

Is this possible to do with mod_rewrite??

The site is built on Opencart.

I've tried what was suggested below: I'm getting internal server error so I've looked at Apache error log and below are the errors:

[Sun Oct 23 03:02:09 2011] [error] [client 120.144.194.243] File does not exist: /home/favstayc/public_html/404.shtml
[Sun Oct 23 03:02:09 2011] [error] [client 120.144.194.243] File does not exist: /home/favstayc/public_html/favicon.ico
[Sun Oct 23 03:02:09 2011] [error] [client 120.144.194.243] client denied by server configuration: /home/favstayc/public_html/error_log
[Sun Oct 23 03:02:09 2011] [error] [client 120.144.194.243] client denied by server configuration: /home/favstayc/public_html/.htaccess

OK I got my answer now. Below is the answer!

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

Upvotes: 1

Views: 402

Answers (1)

Michael Berkowski
Michael Berkowski

Reputation: 270677

Quite simply, using this pattern everything redirects to /store/whatever invisibly for the user. So your user enters http://example.com/some-product, and Apache serves the user http://example.com/store/some-product.

RewriteEngine On
#RewriteCond %{REQUEST_URI} !^store.*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /store$1 [L,QSA]

Upvotes: 2

Related Questions