.htaccess domain slash username to username page p

2019-09-05 19:03发布

I get an error. or problem that I would like some help on. I would like to make it easier for users to go directly to a users profile like how facebook and twitter do. eg: twitter.com/kanyewest. my .htaccess looks like this Please assist me on how i can make my redirect similar to twitter, etc.

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} ^(.*(data|tmp|log).*\.php)$
RewriteRule .*$ – [F,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>

My website is set up like www.mydomain.com/u/1

1条回答
爷的心禁止访问
2楼-- · 2019-09-05 19:36

Not 100% sure but try something like this:

RewriteRule /([a-zA-Z0-9]+)/$ /u/$1

That will send requests for mydomain.com/username to mydomain.com/u/username without changing the url.

查看更多
登录 后发表回答