Apache .htaccess rewriting

為{幸葍}努か 提交于 2019-12-13 03:23:20

问题


this is what I want to achieve.

I want to rewrite this url http://example.com?page=something to this http://example.com/something

such that i can $_GET whatever is after the url $_GET['page']= 'something'

all the tutorials I've read show it like http: //example.com/page /something so i was wondering if it is possible without the extra "/"

//Update

this is what i have on the.httaccess file

RewriteEngine on RewriteRule ^(.*)/?$ index.php?page=$1 [L]

but when i do a echo($_GET['page'] ); i get index.php


回答1:


try this:

    RewriteEngine on
    Options +FollowSymLinks

    RewriteRule ^something/?$ /something.php



回答2:


It needs to accept a parameter though

RewriteRule ^(.*)/?$ index.php?page=$1 [L]


来源:https://stackoverflow.com/questions/9299793/apache-htaccess-rewriting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!