我用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友好的资源,我可以查看有用的信息。
答案 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="/" />