|
|
Welcome to the Exploding Garrmondo Weiner Interactive Swiss Army Penis. |
GFF is a community of gaming and music enthusiasts. We have a team of dedicated moderators, constant member-organized activities, and plenty of custom features, including our unique journal system. If this is your first visit, be sure to check out the FAQ or our GFWiki. You will have to register before you can post. Membership is completely free (and gets rid of the pesky advertisement unit underneath this message).
|
|
Thread Tools |
.htaccess aids
So I'm rewriting
http://slyph.org/music/kylelandry/vi...asie_Impromptu to http://slyph.org/music/kylelandry/vi...sie_Impromptu/ , though I can't get it to work if the htaccess'd url is missing an end slash. Here's the contents of my .htaccess, Code:
Options +FollowSymLinks RewriteEngine on ReWriteBase /music/kylelandry/video/ RewriteRule play/(.*)/ index.php?play=$1 RewriteRule play/(.*) index.php?play=$1 Going to investigate further, though I'm not sure what I'm going to do, as that htaccess looks perfect to me [edit] Ok, I updated my script so that if it is a bad request then it'll echo what the request was, and it looks like the / in my variables is fucking with it. When requesting one without the end /:
Jam it back in, in the dark.
Last edited by Roph; May 29, 2007 at 11:15 AM.
|
If I'm remembering correctly, the existence of URLs without a trailing slash requires that you do something like this for the second RewriteRule:
Code:
RewriteRule play/(.*)/(.*) index.php?play=$1$2 There's nowhere I can't reach. |
Instead of this:
Code:
RewriteRule play/(.*)/ index.php?play=$1 RewriteRule play/(.*) index.php?play=$1 Code:
RewriteRule play/(.*)/? index.php?play=$1 This thing is sticky, and I don't like it. I don't appreciate it. |
That makes it work for requests without the end slash, though breaks it when a slash is used ;_;
Thanks for the help =D I am a dolphin, do you want me on your body? |
I think your real problem is that the regex pattern .* is greedy, in that it will try to match the longest string of text possible. Given the text:
/play/Classical/Chopin_-_Fantasie_Impromptu/ /play/(.*)/? will always include the trailing slash in the match because it still satisfies the pattern and is longer than a match without the slash. The solution is to use a non-greedy qualifier such as /play/(.*?)/? instead. That will try to match as little text as possible while satisfying the pattern. I was speaking idiomatically.
---
|