Re: UrlRewrite htaccess confusion
| From: | Shawn McKenzie | Date: | Thu, 29 Oct 2009 14:52:34 +0000 |
| Subject: | Re: UrlRewrite htaccess confusion | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-299505@lists.php.net to get a copy of this message | ||
Rob Gould wrote:
> I feel like I'm really close to a solution for the clean-url method in
> htaccess. I've successfully got it now so that:
>
>
> http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game
>
> maps to:
>
>
> http://benchwarmersports.com/packages.php?category=basketball&year=2010&title=nba-all-star-game
>
>
> However, I'm finding that when I click on subsequent links from:
>
>
> http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game
>
> that I land in a strange url-structure where it replicates the packages
> part of the url.
>
> Can someone tell me what I might need to change about my rewrite logic
> to fix this issue? I'm getting lost in the world of base urls and
> recursive rewrites...
>
It's hard to tell without seeing the link and/or what code you use to
generate it, but off the top of my head I would say that it's not a
rewrite issue. It seems to be an issue with using relative URLs in your
links. If you are on this page (this is in your browser address bar):
http://benchwarmersports.com/packages.php?category=basketball&year=2010&title=nba-all-star-game
The browser will interpret all relative links like 'somefile.php' as:
http://benchwarmersports.com/somefile.php
But if you use your rewritten URL, then the browser will see relative
links as one of the following (not sure which without testing):
http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game/somefile.php
--or--
http://benchwarmersports.com/packages/basketball/2010/somefile.php
This is because it is interpreting the slashes as path separators. You
probably need to generate absolute URLs in your links.
--
Thanks!
-Shawn
http://www.spidean.com