mod_rewrite rules for live site
mod_rewrite rules for live site
am 27.10.2007 19:22:29 von dennis.sprengers
* 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/
/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//files/* > //sites/
/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 :-)
Re: mod_rewrite rules for live site
am 27.10.2007 19:50:29 von zeldorblat
On Oct 27, 1:22 pm, dennis.spreng...@gmail.com wrote:
> * I'm trying to work out some rewrite rules that should do the
> following:
>
> case 1: a request to mysite.com:
> rewritehttp://www.mysite.com/files/sheets.ppt
> tohttp://www.mysite.com/sites/default/files/sheets.ppt
>
> case 1 - n: a request to othersite.com:
> rewritehttp://www.othersite.com/files/sheets.ppt
> tohttp://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/
> /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//files/* > //sites/
> /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 :-)
You're making it harder than you need to. Just use an alias:
Alias /files /sites/default/files
Re: mod_rewrite rules for live site
am 27.10.2007 20:23:58 von dennis.sprengers
> You're making it harder than you need to. Just use an alias:
>
> Alias /files /sites/default/files
I would really like it to work with mod_rewrite rules in .htaccess, so
that I don't have to create a new alias for every website I might add
in the future. So if you understand mod_rewrite, please throw me a
bone here :-)
Re: mod_rewrite rules for live site
am 27.10.2007 20:25:02 von Jerry Stuckle
dennis.sprengers@gmail.com wrote:
> * 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/
> /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//files/* > //sites/
> /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 :-)
>
>
And your PHP question is?
Try an appropriate newsgroup - such as alt.apache.configuration.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================