Re: RewriteRule to hide PHP vars in URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2009-10-25 at 12:51 -0400, Rob Gould wrote:

> Isn't there a way to tell the Rewrite rule to skip anything found in a  
> js or images subfolder?
> 
> 
> On Oct 25, 2009, at 12:26 PM, Ashley Sheridan wrote:
> 
> > On Sun, 2009-10-25 at 11:04 -0400, Rob Gould wrote:
> >>
> >> I'm trying to follow the RewriteRule docs to make it so that:
> >>
> >>   http://benchwarmersports.com/packages/super-bowl-xliv/1
> >>
> >> can be entered into the web-browser, and it transforms into:
> >>
> >> http://benchwarmersports.com/packages.php?title=super-bowl-xliv&eventid=1
> >>
> >>
> >> The good news is that it does transform the url when I do this. The
> >> bad news
> >> is that it also attempts to transform all the links (including to JS
> >> files
> >> and images).
> >>
> >>   Can someone tell me what I'd need to modify to avoid this problem
> >> with the
> >>   RewriteRule?
> >>
> >>
> >> My .htaccess file presently looks like this:
> >>
> >>
> >>   Options +FollowSymlinks
> >>   RewriteEngine On
> >>   RewriteOptions MaxRedirects=10
> >>   RewriteBase /
> >>
> >>   RewriteRule ^packages/([^/]+)/([^/]+)$ /packages.php?title=
> >> $1&eventid=$2 [NC]
> >>
> >>
> >>
> >>
> >>
> >>
> >
> > It's because in your HTML the URL's to the JS and images are  
> > relative. Changing them to absolute should fix the problem
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> 


The rewrite rule isn't doing that though. What it is doing, is
converting the URL you give to something else on the server. The browser
still thinks it it the URL you gave though, so when it finds an image
going to "images/image1.jpg" it looks for that relative to the current
page it thinks it is displaying, irrespective of what the server is
doing.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux