开发者

Changing Link Structure?

what to write in .htacess file so that i can convert the following link

post.php?id=$id

to

$id/something-anything

so that by hitting the link $id/something-anything it will redirect to post.php?id=开发者_开发技巧$id automatic

I've tired this but faild

Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.+?)$ post.php?id=$1

Thanks

Why ! i want to change for example post.php?id=4 to 4/hello-world-love-you then by hitting this link 4/hello-world-love-you it will send to another file called post.php the id as 4/hello-world-love-you and by using $realid = array_shift(explode("/", $id)); then i can get the real id of the post back which is 4 and do anything i want :) that is exactly i'm thinking about.


it will solve your problem!

RewriteRule ^(\d+)/(.*) post.php?id=$1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜