开发者

WEb-Programming: Forward any Param of an URL not into a directory but to a file

I got another question about .htaccess:

I want every param whic开发者_如何学运维h is given to my homepage (http://some.com/blabla) not to look for the folder "blabla", it should be automatically (immaterial which param, could be blublu too) redirected to a specific file.

How can I do this?

Thx for help

EDIT: It is important too that I know the given param after the redirecting, so if I could solve it by a redirect into a php-file with a GET-Param, this would be good...


Just post this line to .htaccess

RewriteRule ^(.*)$ yourfile.php?$1 [L]

and "blabla" and "blublu" will now forwarded to yourfile.php

The whole .htaccess file:

RewriteEngine on
RewriteBase /

RewriteRule    ^(.*)$ yourfile.php?$1 [L]

In this case, you must have "yourfile.php" in the same directory as .htacces file.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜