mod_alias and mod_rewrite

Hi folks,

I have some difficulties setting up sites using mod_alias and mod_rewrite

As a client request, I have created “3 online stores” but they are just pointing to the same scripts.

In Apache, I have the following virtual host settings:

<VirtualHost *:80>  
     DocumentRoot "/home/dir/store"
     ServerName www.example.com
     Alias /store1 "/home/dir/store"
     Alias /store2 "/home/dir/store"
</VirtualHost>

So basically when the user type in the following URL, they go to the same place:
http://www.example.com/
http://www.example.com/store1
http://www.example.com/store2

And here is the problem, I need to do some SEO settings and make those URL more nicely, and I have the following settings on my .htaccess:

Options +FollowSymlinks
Options -Indexes

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\\?*$ index.php?_route_=$1 [L,QSA]

And it works normally when the user browse via http://www.example.com

However, if users come from http://www.example.com/store1 or http://www.example.com/store2. It just return 404 Not Found when I browse via the site by clicking on links, so what part(s) of .htaccess should I modify to make it work? Thanks!

g+2k,

First, WELCOME to SitePoint’s Apache forum!

I’m sorry, I don’t understand what you’re trying to do. No matter, what you’ve done is wrong.

If you’re trying to create “3 online stores,” you’ll need to use three separate stores and, likely, using three domains. But, as I said, I don’t understand what your marching orders are.

Until that gets sorted out, there is no possibility of using mod_rewrite or .htaccess to do anything.

Regards,

DK

Maybe I try explain a little bit more by simplifying my question.

Basically there are 3 urls pointing to the same site, don’t worry about it is a Blog, a Store or a CMS, in order to achieve of what I am doing, I have to create aliases in Apache pointing to the same place.

But here is the problem, when those users come from http://www.example.com/store1 and http://www.example.com/store2. All these urls are “generated” wrongly without the “sub-directory” and What should I modify in other make those urls work in the following ways, for example:

http://www.example.com/ -> http://www.example.com/index.php?route=common/home -> (Rewrite to) http://www.example.com/common/home
http://www.example.com/store1 -> -> http://www.example.com/store1/index.php?route=common/home -> (Rewrite to) http://www.example.com/store1/common/home
http://www.example.com/store2 -> http://www.example.com/store2/index.php?route=common/home -> (Rewrite to) http://www.example.com/store2/common/home

Feel free to ask me if anyone need any more information or something need to be clarified. Thank you so much!

G+2k,

From what you’re saying, use

Redirect 301 /store1/ http://www.example.com
Redirect 301 /store2/ http://www.example.com

Regards,

DK