HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Tips/Tricks/Mods (http://www.howtoforge.com/forums/forumdisplay.php?f=19)
-   -   Tip: URL Aliases vs. Redirects (http://www.howtoforge.com/forums/showthread.php?t=6681)

Dave Lane 6th September 2006 05:23

Tip: URL Aliases vs. Redirects
 
This one had me stumped for a long time - how to use the ISPConfig interface to specify Co-Domains that should redirect vs. those that should simply be aliases...

Turns out it's easy, just not obvious.

Here's the scenario: I have a new hosting client who wants to run 2 separate Drupal sites off of one account, with two separate domains: domainone.com and domaintwo.com. Because of Drupal's "multisite" capabilities, I want requests for both domains to go to the same DocumentRoot /srv/www/clientXX/web/drupal but to do so with the original domain name intact - i.e. I want the virtual host configuration to direct requests for both domainone.com and domaintwo.com to that DocumentRoot without rewriting them. That's what I refer to as domain aliasing.

To complicate things, my clients want the www. subdomains to redirect to their respective naked domains, i.e. if a user types in the URL http://www.domainone.com - it should get to the right place, but the domain that's actually fed to Apache should be domainone.com (without the www).

The way to achieve this is as follows:
1. create a "new site" or go to an existing site you want to modify

First the alias:
2. choose one domain as the "master" domain for the ISPConfig site "basis" - let's say domainone.com
3. go to the co-domain tab and enter "new" co-domain
4. set the "domain" to be domaintwo.com - enter nothing else (no forward info or anything - this will be an alias to the default domain, domainone.com - but will not be rewritten to anything. This corresponds to simply creating a "ServerAlias" entry in the VirtualHost definition.

Now the redirects:
5. create a "new" co-domain, enter "www" for the host and "domainone.com" for the domain
6. then go to the "forward" tab and enter the full URL you want to redirect to: http://domainone.com - this will create the appropriate ServerAlias entry as well as the Rewrite rules.
7. repeat 5 and 6 for domaintwo.com

Hope that helps someone!

Dave

edge 6th September 2006 09:04

Nice one Dave, but can this not be done with a simple .htaccess rule, or am I misunderstanding your setup?

Dave Lane 18th September 2006 01:55

Hi Edge (if that's your real name ;) ),

Yes, it probably can be done with a .htaccess file, but I was interested in seeing how it could be done within the ISPConfig framework - doing it that way makes management of many sites easier. When I found the way, I decided to document it for others.
Cheers,

Dave

xavier 20th October 2006 01:55

Another Drupal sub-domain question
 
Here's one that has me stumped: "Do I need to configure ISPCONFIG to see Drupal 'sub-domains' ?"

Drupal is extracted right in the /var/www/web5/web directory. I chose Drupal because of it's multisite feature, which seems like it doesn't require an actual subdirectory to the web root directory, but something isn't working. The drupal "sub-domains" are sharing a database with unique headers, and their URLS are configured like this:

drupal/sites/abcd/settings.php ...
$base_url = "http://abcd"
drupal/sites/abcd.def/settings.php ...
$base_url = "http://abcd/def"


But I get "page not found" Do I need to configure co-domains or new domains in ISPCONFIG for this to resolve properly?

xavier 20th October 2006 15:50

Drupal Multi-site and ISPConfig redirects -- linux solution!
 
I'm working on "Ubuntu 6.06 LTS ISP Server Setup" and have a default "Drupal CMS On An ISPConfig Server Within 10 Easy Steps"

I have a site http://abcd, configured in ISPConfig, this works fine.

Now i would like to enable a site http://abcd/def which will have its own Drupal table_prefixes, users, modules, themes - basically a site by itself.

The steps i followed were:
IN DRUPAL
- Modified settings. php as in previous post

IN ISPCONFIG
- Created a new site http://abcd/def
- In Co-domains, clicked on site and set up forward to the web doc root of http://abcd

NO DICE !! But a command line implementation worked ...

cd /var/www/web5/web
ln -s . def

That allows the web server to serve requests to the "def" subdirectory from the main drupal directory. The conceptual leap for me was that the "def" subdirectory is virtual: it only exists in Drupal's database, but if you want to send people to it, the webserver needs to have directions.

I'm sure there is a more sophisticated way to do this using .htaccess or perhaps even ISPConfig, but thought I would share my solution. It's quick!

Best,

x


All times are GMT +2. The time now is 06:22.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.