【发布时间】:2020-06-25 10:19:30
【问题描述】:
我正在制作一个社交网站
目前看起来像这样
htdocs(xampp)
|
___________________________________|___________________________________
| |
login(folder) index.html
如果有人访问 http://localhost/index.html?u=Francis 并且用户 Francis 存在,它将向他们显示 Francis 个人资料,但如果用户 Francis 不存在,则将他们重定向到登录(文件夹)
然后我使用 .htaccess 来代替输入 http://localhost/index.html?u=Francis 你可以输入 http://localhost/francis 它会显示你弗朗西斯的个人资料,但我无法访问 http: //localhost/login 因为没有用户喜欢登录所以它一直重定向
如何让所有看起来像 http://localhost/francis 除了 http://localhost/login 的网址都显示他们的个人资料,
我的.htaccess 文件:
RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+)$ index.html?u=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.html?u=$1
【问题讨论】:
-
欢迎来到 StackOverflow!您能否向我们提供您的 .htaccess 代码?
-
@Vepthy 我的代码是
-
@Vepthy RewriteEngine on RewriteRule ^([a-zA-Z0-9_-]+)$ index.html?u=$1 RewriteRule ^([a-zA-Z0-9_-]+) /$ index.html?u=$1
标签: javascript php .htaccess