One ip address and Multiple web sites

Using a single web hosting account to host multiple sites

One ip address and Multiple web sites

Postby libonati » Sun Oct 18, 2009 10:53 am

Hello all,
I have a root like this:

index.php
folder_images
folder_css
folder_website_a
index.php
folder_website_b
index.php

website a and website b share same css and same images

I wish to set a rule so that if one types www.website-a.com he see the index.php in folder_website_a and if one types www.website-b.com he see the index.php in folder_website_b.

This is what I have in htaccess, but it doesn't works. Where is the error?

RewriteEngine On
RewriteCond %{HTTP_HOST} ^website-a.com [NC]
RewriteRule ^(.*)$ http://www.website-a.com/$1 [L,R=301]
RewriteCond %{REQUEST_URI} !^/folder_website_a/.*$
RewriteRule ^(.*)$ /folder_website_a/$1

RewriteCond %{HTTP_HOST} ^website-b.com [NC]
RewriteRule ^(.*)$ http://www.website-b.com/$1 [L,R=301]
RewriteCond %{REQUEST_URI} !^/folder_website_b/.*$
RewriteRule ^(.*)$ /folder_website_b/$1

Thank you,
Luca
libonati
 
Posts: 5
Joined: Sun Oct 18, 2009 8:45 am

Postby richardk » Mon Oct 19, 2009 11:24 am

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(example\.com|example\.net)$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/folder_website_com ^www\.example\.com(/folder_website_com)$ [NC,OR]
RewriteCond %{HTTP_HOST}/folder_website_net ^www\.example\.net(/folder_website_net)$ [NC]
RewriteRule !^(folder_css|folder_images)(/.*)?$ %1%{REQUEST_URI} [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

it works :)

Postby libonati » Tue Oct 27, 2009 1:27 pm

Amazing. It works...
:D :D :D :D :D :D :D

Thank you really.
I'm sorry I was not able to reply before.
Thank you again.
Luca
libonati
 
Posts: 5
Joined: Sun Oct 18, 2009 8:45 am

Need help... again

Postby libonati » Mon Nov 02, 2009 1:26 pm

Hello,
i need your help again :-?
I need to drive all traffic coming from

www.example.com/aaa/query.html to
www.example.com/page.php?q=query

and

www.example.com/query.html to
www.example.com/page.php?t=query

and repeat the same for differents domains.

So I added after this

Code: Select all
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(example\.com|example\.net)$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/folder_website_com ^www\.example\.com(/folder_website_com)$ [NC,OR]
RewriteCond %{HTTP_HOST}/folder_website_net ^www\.example\.net(/folder_website_net)$ [NC]
RewriteRule !^(folder_css|folder_images)(/.*)?$ %1%{REQUEST_URI} [QSA,L]


These two lines

Code: Select all
RewriteRule ^aaa/([A-Z,a-z,0-9]*)\.html$ page.php?q=$1 [L]
RewriteRule ^([A-Z,a-z,0-9]*)\.html$ page.php?t=$1 [L]


But it doesn't works.
Where is the error?

Thank you in advance.
Luca
libonati
 
Posts: 5
Joined: Sun Oct 18, 2009 8:45 am

Postby libonati » Thu Nov 05, 2009 11:23 pm

I tried also

Code: Select all
RewriteRule ^aaa/([0-9]+)-[^/]+\.html$ /page.php?q=$1 [QSA,L]
RewriteRule ^([0-9]+)-[^/]+\.html$ /page.php?t=$1 [QSA,L]


I've followed suggestions from http://forum.modrewrite.com/viewtopic.php?p=15046#15046


But nothing happen... :(

Luca
libonati
 
Posts: 5
Joined: Sun Oct 18, 2009 8:45 am

Postby libonati » Sun Nov 08, 2009 7:36 am

Really not able to solve this issue.
I tested this RewriteRule

Code: Select all
RewriteRule ^aaa/([A-Z,a-z,0-9-]*)\.html$ page.php?q=$1  [L]


here http://civilolydnad.se/projects/rewriterule/

and with a url like: www.my-domain-com/aaa/my-page.html all works.
But if I add this rule inside my .htaccess nothing happen.

Why?? :-?
This is my last point to close a project.
Anyone has an idea?

Thanks,
Luca
libonati
 
Posts: 5
Joined: Sun Oct 18, 2009 8:45 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 14 guests

cron