开发者

.htaccess with database

How can I d开发者_运维百科o this that mydomain.com/ -> mydomain.com/profile.php?username=

Now You can start search via url like domain.com/

My htaccess file is

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=search&val=$1 [QSA,L]

I can understand in php file

$val = $_GET['val'];
if($c->userNameCheck($val))
{
    header("Location:".$url."/profile.php?username=".$val);
}

But I dont want to show profile.php


You could simply replace the rule with:

RewriteRule ^(.*)$ profile.php?username=$1 [QSA,L]

However, since you won't be executing the index.php file, the userNameCheck method won't be called. I assume it does some sort of a check if the provided parameter is a valid username -- to make it run with the modified rule, you'd have to move that call to the profile.php file.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜