I'm having some trouble with mod_rewrite in my .htaccess file.
I've found numerous tutorials about how to do the reverse of what I'm trying to accomplish.
Basically I need a solution to change directories to get variables.
So that this:
http://example.org/page-1
turns into开发者_StackOverflow社区
http://example.org/?link_id=page-1
I think I got a code that would do something almost to what I need, but I was getting redirect loops.
Here you go:
RewriteEngine On
RewriteRule ^page-([0-9]*)$ index.php?link_id=page-$1
Note: I'm not sure that index.php
is your DirectoryIndex
. If it's not, you should change it according to your index file.
精彩评论