Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
url重写搞乱了php_Php_.htaccess_Dynamic_Url Rewriting - Fatal编程技术网

url重写搞乱了php

url重写搞乱了php,php,.htaccess,dynamic,url-rewriting,Php,.htaccess,Dynamic,Url Rewriting,我在我的网站上为日历重写了这个url。代码如下: RewriteRule ^calendar/([0-9]{4})/([0-9]{2})$ /calendar/?year=$1&month=$1 这样我就可以用domain.com/calendar/yyyy/mm代替。问题是它会弄乱页面上的所有图像、css、php等文件。我将此添加到头部并修复css和图像: <base href="http://www.domain.com/"> 问题是您在css/js/图像中使用了相对

我在我的网站上为日历重写了这个url。代码如下:

RewriteRule ^calendar/([0-9]{4})/([0-9]{2})$ /calendar/?year=$1&month=$1
这样我就可以用domain.com/calendar/yyyy/mm代替。问题是它会弄乱页面上的所有图像、css、php等文件。我将此添加到头部并修复css和图像:

<base href="http://www.domain.com/">

问题是您在css/js/图像中使用了相对链接


您需要确保在css、js、图像文件中使用绝对路径,而不是相对路径。这意味着您必须确保这些文件的路径以http://或斜杠开始。

问题在于日历。“上个月/下个月”按钮不起作用。这些事件不在日历上。即使我在url中更改了月份,它也会转到错误的月份,即使我转到domain.com/2014/XX,它也会显示十月
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)/([^/]+) calendar/?year=$1&month=$1 [NC]