我试图使我的url yourwebsite/funusername从yourwebsite/profile.php?username=funusername。我尝试过。htaccess,如:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^'.]+)$ $1.php [NC,L]
RewriteRule ^/([^/]+)$ profile.php?username=$1
(我也有代码在那里,使它把.php
从我的页面)。我对。htaccess非常没有经验,所以任何帮助都是非常感激的。
附加:我如何在链接中引用这个URL ?如<a href="profileurl">
你可以创建一个页面yourwebsite/funusername/index.html和加载yourwebsite/profile.php?使用jQuery load.
下面是一个工作示例:
网站代码/funnyusername/index.html:
<!doctype html>
<html>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("html").load("/path/to/profile.php?username=funnyusername");
});
</script>
</html>
然后删除你的网站/account.php的html标签。
如果你有一个<!doctype html>
标签在你的网站/帐户。php删除它。
例句:
<head>
** Whatewer code you have here **
</head>
<body>
** Whatever code you have here **
</body>
你也可以用iframe来做,但这是我怎么做的