apache - MOD REWRITE (BASE) on WAMP Server -
i have wamp webserver rewrite module activated.
i have projects in:
d:/prj/costumer1/www/ (alias: costumer1) d:/prj/costumer2/www/ (alias: costumer2) , on...
for costumer1 have .htaccess-file works fine. looking this:
rewriteengine on rewritebase /costumer1/ rewriterule ^([^/\.]+)/?$ index.php?a=$1 [qsa] rewriterule ^([^/\.]+)/?/([[a-za-z0-9_-]+)$ index.php?a=$1&b=$2 [qsa] rewriterule ^([^/\.]+)/?/([[a-za-z0-9_-]+)/?/([[a-za-z0-9_-]+)$ index.php?a=$1&b=$2&c=$3 [qsa]
now when create src/href-link have use:
/costumer1/search/book/novell (aka: costumer1/?a=search&b=book&c=novell)
instead of
/search/book/novell (aka: costumer1/?a=search&b=book&c=novell)
so in short:
i don't want write "/costumer1" in front of every link: <a href="/costumer1/search/">search</a>
i have done in root .htaccess
rewritecond %{http_host} ^customer1$ [nc] rewritecond %{request_uri} !^/customer1 rewriterule ^(.*)$ customer1/$1 [l,ns]
but eventually, moved away handling .htaccess
less scalable, , went on setting virtual hosts, this:
<virtualhost *:80> documentroot "d:/htdocs/customer1" servername customer1 </virtualhost> <virtualhost *:80> documentroot "d:/htdocs/customer2" servername customer2 </virtualhost>
and work, of course edit hosts file, have lines this:
127.0.0.1 customer1 127.0.0.1 customer2
Comments
Post a Comment