• .htaccess url rewrite
    4 replies, posted
I'm making my own forums right now and i'm trying to make the url a lot more pretty to look at and read this is was it looks like right now [CODE]http://localhost/mysite/forums/view/index.php?id=1[/CODE] I'm trying to make it look like this [CODE]http://localhost/mysite/forums/view/1[/CODE] How would i be able to achieve this?
Something along the lines of this should work [CODE] RewriteEngine on RewriteRule ^forums/view/(.*)$ ./forums/view/index.php?id=$1 [L] [/CODE]
Alternatively you could use a router such as klein.php: [url]https://github.com/chriso/klein.php[/url]
Kragmars would i then change my links to this? [CODE]<a href="http://localhost/mysite/forums/view/<?php echo $sub['sub_id'];?>[/CODE] or leave them like this [CODE]<a href="http://localhost/mysite/forums/view/index.php?id=<?php echo $sub['sub_id'];?>[/CODE]
[QUOTE=Ace45;46058776]Kragmars would i then change my links to this? [CODE]<a href="http://localhost/mysite/forums/view/<?php echo $sub['sub_id'];?>[/CODE] or leave them like this [CODE]<a href="http://localhost/mysite/forums/view/index.php?id=<?php echo $sub['sub_id'];?>[/CODE][/QUOTE] Either of which should work
Sorry, you need to Log In to post a reply to this thread.