Php .htaccess url:重写本地主机Xampp上缺少的css javascript和图像文件
我是新来的。我正在尝试使用模式重写为用户创建用户友好的URL。我的问题是,当我使用.htaccess re:write打开“user.php”页面时,它无法加载CSS文件或图像文件,并显示如下Php .htaccess url:重写本地主机Xampp上缺少的css javascript和图像文件,php,css,.htaccess,mod-rewrite,Php,Css,.htaccess,Mod Rewrite,我是新来的。我正在尝试使用模式重写为用户创建用户友好的URL。我的问题是,当我使用.htaccess re:write打开“user.php”页面时,它无法加载CSS文件或图像文件,并显示如下 Sign up My account Hi My Profile My account Logout Help © 2014 Company, Inc. 我有这样一个链接: http://localhost/www.zeeshan.com/user.php?nam
Sign up
My account
Hi
My Profile
My account
Logout
Help
© 2014 Company, Inc.
我有这样一个链接:
http://localhost/www.zeeshan.com/user.php?name=zeeshan06
新的链接是这样的,它的工作100%适合我
http://localhost/www.zeeshan.com/user/zeeshan06
我的.htaccess文件
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /www.zeeshan.com/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^user/([^/]+)$ user.php?name=$1 [NC,L]
www.zeeshan.com文件夹中的我的CSS文件路径CSS/style.CSS、CSS/bootstrap.CSS、bootstrap.min.CSS
<head>
<link href="style.css" rel="stylesheet" type="text/css"/>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css"/>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
使用out.htaccess页面可以很好地显示div、panel等的css,但使用.htaccess
回复:写入它无法打开css文件和图像文件。请帮我解决我的问题。谢谢..您的CSS文件路径是相对的。所以当你加载
http://localhost/www.zeeshan.com/user/zeeshan06
,您的浏览器正在名为http://localhost/www.zeeshan.com/user/
。您需要将路径更改为:
<head>
<link href="/www.zeeshan.com/style.css" rel="stylesheet" type="text/css"/>
<link href="/www.zeeshan.com/css/bootstrap.css" rel="stylesheet" type="text/css"/>
<link href="/www.zeeshan.com/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
如果在
标记内的每个页面上都放置了一个静态链接,则在部署后需要重新更改它
使用以下命令:
<base href= "<?php echo "http://".$_SERVER['HTTP_HOST']."/your_folder/" . "/>" ; ?>"
请使用css和图像的完整url+1个好答案。如果不想替换所有链接,也可以在
之后使用