You are here: mod_rewrite rules for live site « PHP Programming Language « IT news, forums, messages
mod_rewrite rules for live site

Posted by dennis.sprengers on 10/27/07 17:22

* I'm trying to work out some rewrite rules that should do the
following:

case 1: a request to mysite.com:
rewrite http://www.mysite.com/files/sheets.ppt
to http://www.mysite.com/sites/default/files/sheets.ppt

case 1 - n: a request to othersite.com:
rewrite http://www.othersite.com/files/sheets.ppt
to http://www.othersite.com/sites/othersite/files/sheets.ppt

So, if a request comes in to mysite.com, /files/-urls need to be
rewritten do /sites/default/files/sheets/ppt, since mysite is the
default website on the server. Surfing to a file on any other website
that is hosted on the server, needs to be rewritten to /sites/
<name_of_site>/files/sheets.ppt

Sheets.ppt is of course just an example of a file file.

* I first tested my CMS (for which I need these rules) on my own
little server @home, and found these rules to be working OK after
spending hours on forums on apache and mod_rewrite:

# http://localhost/mysite/files/* > /mysite/sites/default/files/*
RewriteCond %{REQUEST_URI}-default ^/mysite/.+-(default)$ [NC,OR]
# http://loclahost/<othersite>/files/* > /<othersite>/sites/
<othersite>/files/*
RewriteCond %{REQUEST_URI}-default ^(.+)(default)$ [NC,OR]

But now I have no clue on where to begin anymore, since it has been a
long time I researched mod_rewrite. Could somebody help me out? Any
help is appreciated :-)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация