Welcome to MobyThreads.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

rewriterule only for .php files

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Related Topics:
help with log files - Hello, I have been running Apache 2.* for many months now. The other day I decided to read the docs. I find that I can keep from logging my own IP when I go onsite to check out my pages. However, I have done the doc's say to do and my IP still..

"large files" - I host a website with Apache 2.0. The website runs fine locally, but when I run the site from an other computer it can't open files larger then 120kb. Does someone has a clue. I also had the same problem with IIS. Thanks in advance. ..

Apache log files - Hi all, How do I configure Apache so that it doesn't overwrite old files. At the moment it has up to 4 files etc). I want to set it so that it just keeps adding more log files as needed. Thanks in advance ..

serving wmv, avi files - I'm running Apache 2.0 on a Linux Fedora server. I'd like to be able to a small (500k) .wmv or .avi video file when when a browser clicks on a link. It doesn't have to be just sending the file would be fine. However, when I do try..

servlet files - hi.. i m using Web Logic as an server, i Mr.David ur last message but the confusion is that i have set the path website/ for jsp files. As u know that the of servlet in web logic server is..
Next:  Apache: Is SSLProxyMachineCertificateFile read in at start or usage?  
Author Message
Kris

External


Since: Apr 11, 2007
Posts: 2



(Msg. 1) Posted: Wed Apr 11, 2007 5:00 am
Post subject: rewriterule only for .php files
Archived from groups: alt>apache>configuration (more info?)

These are my current rules copied from my .htaccess file:

RewriteRule ([a-z]+) index.php?controller=$1 [QSA,NC]
RewriteRule ([a-z]+)/([a-z]+) index.php?controller=$1&event=$2
[QSA,NC]
RewriteRule ([a-z]+)/([a-z]+)/([a-z]+) index.php?controller=$1&event=
$2&meta=$3 [QSA,NC]

The php application works as intended, no problem there, but I cannot
use <link href="media/css/style.css"> because that is rewritten into
index.php?controller=media

How do I avoid this? The rewrite rules should only apply for .php
files and nothing else.

 >> Stay informed about: rewriterule only for .php files 
Back to top
Login to vote
Kris

External


Since: Apr 11, 2007
Posts: 2



(Msg. 2) Posted: Wed Apr 11, 2007 11:06 am
Post subject: Re: rewriterule only for .php files [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Apr 11, 5:37 pm, Michael Daly <MichaelD... DeleteThis @foo.bar> wrote:
> Kris wrote:
> > RewriteRule ([a-z]+)/([a-z]+)/([a-z]+) index.php?controller=$1&event=
> > $2&meta=$3 [QSA,NC]
>
> > media/css/style.css"> because that is rewritten into
> > index.php?controller=media
>
> ([a-z]+) will not match on "style.css" - you have to account for the
> period. Try ([a-z.]+) with meta=$3 or ([a-z]+(.[a-z]+)?) with meta=$4.
> To be more specific on the file extension, you could use ([a-z]+(.css)?)
> with meta=$4.
>
> Google "regexp tester" to find a web-based regular expression tester.
> That will allow you to test the expression with your input and you'll
> see exactly what gets returned.
>
> Mike

But I only want to rewrite URLs where the .php extension is present or
where the index file is being used.
Any thing besides .php files should not be affected.

 >> Stay informed about: rewriterule only for .php files 
Back to top
Login to vote
Michael Daly

External


Since: Mar 14, 2007
Posts: 8



(Msg. 3) Posted: Wed Apr 11, 2007 11:37 am
Post subject: Re: rewriterule only for .php files [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Kris wrote:

> RewriteRule ([a-z]+)/([a-z]+)/([a-z]+) index.php?controller=$1&event=
> $2&meta=$3 [QSA,NC]
>
> media/css/style.css"> because that is rewritten into
> index.php?controller=media


([a-z]+) will not match on "style.css" - you have to account for the
period. Try ([a-z.]+) with meta=$3 or ([a-z]+(.[a-z]+)?) with meta=$4.
To be more specific on the file extension, you could use ([a-z]+(.css)?)
with meta=$4.

Google "regexp tester" to find a web-based regular expression tester.
That will allow you to test the expression with your input and you'll
see exactly what gets returned.

Mike
 >> Stay informed about: rewriterule only for .php files 
Back to top
Login to vote
Michael Daly

External


Since: Mar 14, 2007
Posts: 8



(Msg. 4) Posted: Wed Apr 11, 2007 2:48 pm
Post subject: Re: rewriterule only for .php files [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Kris wrote:
> On Apr 11, 5:37 pm, Michael Daly <MichaelD....TakeThisOut@foo.bar> wrote:
>> Kris wrote:
>>> RewriteRule index.php?controller=$1&event=
>>> media/css/style.css"> because that is rewritten into
>>> index.php?controller=media
>> ([a-z]+) will not match on "style.css" - you have to account for the
>> period. Try ([a-z.]+) with meta=$3 or ([a-z]+(.[a-z]+)?) with meta=$4.
>> To be more specific on the file extension, you could use ([a-z]+(.css)?)
>> with meta=$4.

> But I only want to rewrite URLs where the .php extension is present or
> where the index file is being used.
> Any thing besides .php files should not be affected.

Then you have to set your conditions to check for that.

RewriteRule ^index\.php\?([a-z]+)/([a-z]+)/([a-z]+)
index.php?controller=$1&event=$2&meta=$3 [QSA,NC]

Mike
 >> Stay informed about: rewriterule only for .php files 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]