Solved

.htaccess ro run multiple sites

Posted on 2007-04-02
1
197 Views
Last Modified: 2010-03-04
This file works great, but only for 1 domain. I need to add a 2nd running from the folder /v2/

Its fine to show the subfolder in the urls, but I would also like this script to check for the "www." prefix and remove it. How can I configure the htaccess to rewrite the urls properly ?

Goal ..
http :// domain1 .com /site/
http :// domain2 .com /v2/

Here is the code Im starting with:
---
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^$ /site/ [L,R]
0
Comment
Question by:mcsolas
1 Comment
 
LVL 11

Accepted Solution

by:
JamesCssl earned 500 total points
ID: 18841045
#remove the WWW
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^/?(.*) http://%1/$1 [R=301,L]

# example.com
RewriteCond %{REQUEST_URI} !^/?site
RewriteCond %{HTTP_HOST} example\.com [NC]
RewriteRule ^/?(.*)$ /site/$1 [L]
RewriteRule ^/?site/$ - [L]

# example.net
RewriteCond %{REQUEST_URI} !^/?v2
RewriteCond %{HTTP_HOST} example\.net [NC]
RewriteRule ^/?(.*)$ /v2/$1 [L]
RewriteRule ^/?v2/$ - [L]

Replace example.com and example.net with your domains, and "site" and "v2" with your paths.
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question