I have follwoing url's
我有接下来的网址
http://127.1.1.1/mysite/username/admin
I want to display like this url
我想像这个网址一样显示
http://127.1.1.1/mysite/admin
Here 'username' is file name.
这里'用户名'是文件名。
How it can be possible?
怎么可能?
1 个解决方案
#1
0
Store this .htaccess to http://127.1.1.1/mysite/.htaccess
:
将此.htaccess存储到http://127.1.1.1/mysite/.htaccess:
RewriteEngine on /mysite/
RewriteRule ^(.*)$ username/$1 [r=301,L]
http://127.1.1.1/mysite/admin
-> http://127.1.1.1/mysite/username/admin
http://127.1.1.1/mysite/admin.php?some=value
-> http://127.1.1.1/mysite/username/admin.php?some=value
http://127.1.1.1/mysite/admin - > http://127.1.1.1/mysite/username/admin http://127.1.1.1/mysite/admin.php?some=value - > http://127.1 .1.1 / mysite的/用户名/ admin.php的?一些=值
username.php
username.php
RewriteEngine on /mysite/
RewriteRule ^(.*)$ username.php?requested-file=$1 [r=301,L]
http://127.1.1.1/mysite/admin
-> http://127.1.1.1/mysite/username.php?requested-file=admin
http://127.1.1.1/mysite/admin - > http://127.1.1.1/mysite/username.php?requested-file=admin
#1
0
Store this .htaccess to http://127.1.1.1/mysite/.htaccess
:
将此.htaccess存储到http://127.1.1.1/mysite/.htaccess:
RewriteEngine on /mysite/
RewriteRule ^(.*)$ username/$1 [r=301,L]
http://127.1.1.1/mysite/admin
-> http://127.1.1.1/mysite/username/admin
http://127.1.1.1/mysite/admin.php?some=value
-> http://127.1.1.1/mysite/username/admin.php?some=value
http://127.1.1.1/mysite/admin - > http://127.1.1.1/mysite/username/admin http://127.1.1.1/mysite/admin.php?some=value - > http://127.1 .1.1 / mysite的/用户名/ admin.php的?一些=值
username.php
username.php
RewriteEngine on /mysite/
RewriteRule ^(.*)$ username.php?requested-file=$1 [r=301,L]
http://127.1.1.1/mysite/admin
-> http://127.1.1.1/mysite/username.php?requested-file=admin
http://127.1.1.1/mysite/admin - > http://127.1.1.1/mysite/username.php?requested-file=admin