.htaccess文件:将localhost / sitelogin / profile / name重定向到localhost / sitelogin / profile.php?username = name

时间:2014-07-15 19:13:07

标签: php html css .htaccess

我用html和php编写了很多网站。我已经创建了一个用户配置文件系统,但我真的不明白我需要在.htaccess文件中将“localhost / sitelogin / profile / name”重定向到“localhost / sitelogin / profile.php?username = name”并保留css信息。 profile.php包含require '/includes/overall/oheader.php';,其中包含include 'includes/head.php';,其中包含<link rel="stylesheet" href="css/screen.css">

我很感激直接帮助这个或者一个noob友好的资源,我可以查看有用的信息。

1 个答案:

答案 0 :(得分:0)

将此代码放入DOCUMENT_ROOT/sitelogin/.htaccess文件中:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /sitelogin/

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

对于css / js路径修复,请在页面的HTML <head>部分中使用此功能:

<base href="/" />
相关问题