2012-07-26 74 views
-2

我有一个严重的问题,因为两天试图用htaccess重写我的PHP网站的网址。添加斜杠到我的网址

Options +FollowSymlinks 
RewriteEngine On 

RewriteRule devis demande-devis.php 
RewriteRule mentions-legales mentions-legales.php 
RewriteRule condition-utilisation condition-utilisation.php 
RewriteRule condition-generales-ventes condition-generales-ventes.php 
RewriteRule fournisseur fournisseur.php 
RewriteRule qui-sommes-nous qui-sommes-nous.php 
RewriteRule faq faq.php 
RewriteRule services services.php 

RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_URI} !example.php 
RewriteCond %{REQUEST_URI} !(.*)/$ 
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301] 

但我期望的例子是有http://www.example.com/services/

通过代码,当我在浏览器地址栏中输入该URL时,我有一个没有CSS的网页。

+0

在这个问题中没有足够的精确信息来给出直接的答案。您不提供重写尝试的实际结果,而是模糊地提到可能缺少的样式表。而且:你提到“下面的代码”,而没有实际附加任何代码。 – arkascha 2012-07-26 11:19:35

+0

http://cars-de-france.com看看 – pollux1er 2012-07-26 11:32:26

+0

那个回复中的代码在哪里?重写尝试的结果在哪里?在该URL加载的页面成功加载了几个样式。 – arkascha 2012-07-26 11:34:40

回答

1

最有可能的问题是相对与CSS文件网址的绝对符号。 查阅http服务器错误日志以查看实际引用的内容或检查缺少样式定义的页面的已传递html源。

您在问题的评论中指定的页面显示了css文件的相对和绝对引用。然而你没有重写规则......

+0

你是对!与绝对标志的CSS文件一切都OK! – pollux1er 2012-07-26 11:45:30

0

正常工作。只要确保你设置了正确的链接到你的CSS文件,以便浏览器能够在你的服务器上没有404的请求。

由于您在编写php脚本后可能已编辑过.htaccess文件中的URL,因此您还需要在PHP脚本中反映这些更改,方法是也更新其中的链接。

监控您的服务器错误日志以找出哪些URI被错误地发送。

查看那些。

然后通过修复错误的输出来提高应用程序的输出。

请参阅还有:是你的问题的根源

和类似的问题。