Help - Search - Members - Calendar
Full Version: A quick .htaccess fix?
Invision Power Services > Community Forums > Community Web Design and Coding
DonWilson
I'm looking to change /index.php?cmd=forum&key=value&this=that into /forum?key=value&this=that

I'm sure there's a .htaccess expert around here that could easily do this. Many thanks.
_
Sure. Create a new file, 'forum':
CODE
<?php
include('index.php?cmd=forum');
?>


.htaccess:
CODE
<Files forum>
SetHandler application/x-httpd-php
</Files>


Or, if it gives you a 500 error, replace 'SetHandler' with 'Forcetype'.
DonWilson
There isn't a RewriteRule that'll take this out?
_
There probably is.
Something like... (in the root directory):

CODE
RewriteEngine On
RewriteRule (^[a-zA-Z1-9]*?$) index.php?cmd=$1
DonWilson
Would this allow me to do /forums?this=that&the=true and it turn into index.php?cmd=forums&this=that&the=true ?
_
Should do, if my regexp isn't that bad. rolleyes.gif
-- Also /hello?this=that making it /index.php?cmd=hello&this=that, as it sounded like you wanted a global rule.
DonWilson
CODE
[Sat Mar 19 10:58:06 2005] [alert] [client 64.217.217.228] /home/onlygeek/public_html/cms/.htaccess: RewriteRule: cannot compile regular expression '(^[a-zA-Z1-9]*?$)'\n


pinch.gif
_
Try...

CODE
RewriteRule ([a-zA-Z1-9]*?) index.php?cmd=$1
DonWilson
Nope, still getting a 500 error.
_
I just realised it should be 0-9... but as for the error, blink.gif.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.