Shinyshell Community Forums > Coding > Querystring HALP |
||||||
Sign Up | Member List | New Posts | Help |
[1]
May 23 02009, 23:55 GMT | ||||
Peter* A Pythonic One Location: US Post count: 99 |
Using .htaccess, how do I replace (for example) http://oopsie.com/index.php?id=folder/page with http://oopsie.com/folder/page, as Shinyshell and many other sites are set up? :D
|
May 24 02009, 12:23 GMT | ||||
Nick^ merciful justice Location: Brisbane, Australia Post count: 78 |
Oooh yay. .htaccess is awesome. :D
RewriteEngine on #Make it so that /index.php?id=folder/page is /folder/page RewriteRule ^([A-Za-z0-9_-]+)$ index.php?id=$1 I'm pretty confident that that code will work. ______________________________ Lazurane |
May 24 02009, 13:53 GMT | ||||
Peter* A Pythonic One Location: US Post count: 99 |
A couple of problems. My page, index.php?id=layouts/index doesn't work like this .../layouts/index. Also, ?id=tutorials/table-layouts ~ ../tutorials/table-layouts doesn't work...
It seems that if they're in a different folder it refuses to work. |
May 25 02009, 07:04 GMT | ||||
Nick^ merciful justice Location: Brisbane, Australia Post count: 78 |
May 26 02009, 19:22 GMT | ||||
Kthar Krme jedno bezglavo Location: kroatie Post count: 106 |
Alright, I waited long enough for you, Lec, to post a reply and unravel the mystery, but I just have to post a reply here or it might look as if I'm not doing anything.
|
May 26 02009, 21:33 GMT | ||||
Peter* A Pythonic One Location: US Post count: 99 |
You can observe for yourself... http://z-design.jenviousity.com ; almost all the pages are found on the nav. :D
|
May 27 02009, 06:49 GMT | ||||
Nick^ merciful justice Location: Brisbane, Australia Post count: 78 |
Try this then, it's a bit hacky though:
RewriteEngine on #Make it so that /index.php?id=x is /x (x = string) RewriteRule ^([A-Za-z0-9_-]+)$ index.php?id=$1 #Make it so that /index.php?id=x/y is /x/y (x & y = one string) RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ index.php?id=$1$2 ______________________________ Lazurane |
May 27 02009, 10:18 GMT | ||||
lec** Supra stultitiam Location: Varaždin, Croatia Post count: 173 |
It's not hacky, that's how I would do it.
.htaccess can cause unexpected glitches, so it's best to limit the rewriting to a minimum. Also, Nick, you have an error. The last line should be: RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ index.php?id=$1/$2 Also, fixed some problems with the bbcode parser (code now displays nicely) |
May 27 02009, 11:40 GMT | ||||
Nick^ merciful justice Location: Brisbane, Australia Post count: 78 |
Hmm... I just thought it wasn't working because I was doing something stupid - hence why I said it was "hacky". And, at the time, I thought it was correct, so it was a stupid mistake as opposed to an error.
And, I was about to mention that annoying bbcode code stretching thing. ______________________________ Lazurane |
May 27 02009, 21:13 GMT | ||||
Peter* A Pythonic One Location: US Post count: 99 |
Gasp! It works. I should learn a little bit more about this stuff. Thanks for your help, Nick and Electron!
|
May 27 02009, 21:18 GMT | ||||
lec** Supra stultitiam Location: Varaždin, Croatia Post count: 173 |
Of course :)
If you need more comments/ideas/help with your site, do ask. *closed* (to keep kthar from posting just to increase his postcount) |
[1]
Forum Information |
||||||||||
|