You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chris Blackwell <ch...@blueyonder.co.uk> on 2004/01/02 13:57:15 UTC

[users@httpd] mod_rewrite for user homepages problem

Hi all, my first post to the list :)

I am working on a rebuild of a site for a client.  They operate local
business directories, they have 8 domains and offer their business space to
put a few pages, which are linked to from the entry in the directory.

Currently the 8 sites have seperate docroots and each of the businesses  get
a directory off of the docroot.. like:

www.domainA.com/businessX
www.domainB.com/businessY

I am pulling all the domains to use a single set of coldfusion templates
(and one database, not 8!) and wanted to reorganise the directory structure
a bit.

I need www.domainB.com/businessY to be rewritten to
/_homepages/www.domainB.com/businessY.  I also have a list of common
directories to exclude, any .cfm templates in the root directory need to be
accessed as normal and requests without a file need to use the
directoryindex directive to pickup the correct index file.

Below is the vhost i have so far, its not working as it rewrites everything
to /_homepages/...

Any suggestion.. ?

Thanks, Chris



<VirtualHost 192.168.100.100>
	UseCanonicalName off
	ServerName ukcd
	DocumentRoot /var/www/html/ukcd/
	ServerAlias dundeecd edinburghcd elgincd glasgowcd invernesscd perthcd
stirlingcd aberdeencd

	DirectoryIndex index.cfm index.html
	# rewrite rules for search engine friendly urls
	RewriteEngine On

	RewriteRule ^/category/([0-9]+)(.*) /category.cfm\?c=$1 [PT]
	RewriteRule ^/browse/([a-zA-Z]+)(.*) /browse.cfm\?s=$1 [PT]
	RewriteRule ^/entry/([0-9]+)(.*) /entry.cfm\?e=$1 [PT]
	RewriteRule ^/swapdir/([0-9]+)/([0-9]+) /index.cfm\?cfid=$1&cftoken=$2 [PT]

	RewriteRule ^/login/ /_include/login.cfm [PT]
	RewriteRule ^/logout/ /_include/logout.cfm [PT]

	RewriteMap    lowercase    int:tolower

	RewriteRule ^/images/header/.*
/_homepages/${lowercase:%{HTTP_HOST}}/_header/$1 [PT]

	RewriteCond   %{REQUEST_URL}  !^/
	RewriteCond   %{REQUEST_URL}  !^/.*\.cfm
	RewriteCond   %{REQUEST_URL}  !^/_include/.*
	RewriteCond   %{REQUEST_URL}  !^/_homepages/.*
	RewriteCond   %{REQUEST_URL}  !^/account/.*
	RewriteCond   %{REQUEST_URL}  !^/admin/.*
	RewriteCond   %{REQUEST_URL}  !^/CFIDE/.*
	RewriteCond   %{REQUEST_URL}  !^/components/.*
	RewriteCond   %{REQUEST_URL}  !^/css/.*
	RewriteCond   %{REQUEST_URL}  !^/headers/.*
	RewriteCond   %{REQUEST_URL}  !^/import_scripts/.*
	RewriteCond   %{REQUEST_URL}  !^/profile/.*
	RewriteCond   %{REQUEST_URL}  !^/register/.*
	RewriteCond   %{REQUEST_URL}  !^/scripts/.*
	RewriteRule ^/(.*)$   /_homepages/${lowercase:%{HTTP_HOST}}/$1
</VirtualHost>



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org