开发者

Use ? at end of url without the need for pagename.ext

开发者 https://www.devze.com 2023-02-01 03:58 出处:网络
On my website I pass parameters like this: http://www.mysite.com/somepage.php?action=something But I would like do just do this:

On my website I pass parameters like this:

http://www.mysite.com/somepage.php?action=something

But I would like do just do this:

http://mysite.com/?action=something

How can I do this? Do you know of any good, simple resources around? I can't find any because I don't know exactly what 开发者_如何学Goto look for.

Lots of thanks in advance!

jase


The URL you show will usually go to the index file in the root directory (e.g. index.php).

You will be able to catch $_GET["action"] from there without any additional work.


.htaccess

RewriteEngine On
RewriteRule ^([^/]*)$ /somepage.php?action=$1 [L]
0

精彩评论

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