Apache mod_rewrite为不同的URL提供相同的内容

时间:2011-12-11 18:03:38

标签: apache url mod-rewrite apache2 mod-cache

我有一个奇怪的问题,我无法找到答案。我用mod_disk_cache设置了apache2服务器。我有奇怪的问题,我得到不同的URL的相同页面。假设我通过主页访问页面 - 它工作正常。如果我转到文章,从主页,我可以看到文章 - 工作正常。回到主页 - 工作正常。从主页到其他一些文章 - 问题:我仍然有主页的内容。

我是我的开发服务器一切正常。在生产服务器上,我遇到了这些问题。

一些细节:

DEV服务器: Windows 7的 apache 2.2.17 php:5.3.4

PRODUCTION服务器: CentOS的 apache 2.2.3 php:5.2.9

HTTPD.CONF

...
ExpiresActive On

<Directory "/var/www/html/site-name">
  Options FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  Allow from all

  ExpiresDefault A86400

  <FilesMatch "\.(jpg|png|gif)">
    ExpiresDefault A31536000
  </FilesMatch>
  <FilesMatch "\.(js|css)$">
    ExpiresDefault A31536000
  </FilesMatch>  

</Directory>

# Server Caching!
<IfModule mod_cache.c>
  <IfModule mod_disk_cache.c>
    CacheRoot /opt/cache-dir
    CacheEnable disk /
    CacheDirLevels 5
    CacheDirLength 3
  </IfModule>
</IfModule> 

# Server Compressing
#SetEnv gzip-only-text/html 1

<Location />
  SetOutputFilter DEFLATE
  AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml
  AddOutputFilterByType DEFLATE application/x-javascript
</Location>

# Disable captcha caching! 
<Location "/index/captchaimage">
  Header Set Cache-Control "max-age=0, no-store"
  Header Set Expires "Sun, 11 Dec 2011 00:18:40 GMT"
</Location>

MOD_REWRITE配置

RewriteCond %{HTTP_HOST} ^(www\.|es\.|forum\.)?domain\.com$ [nc]
RewriteRule ^robots\.txt$ - [L]


RewriteRule ^sitemaps\.xml /index.php?get_sitemap=1 [NC,L]
RewriteRule ^sitemaps\.es\.xml /index.php?get_sitemap=1&lang=es [NC,L]
RewriteRule ^sitemaps\.forum\.xml /index.php?get_sitemap=1&type=forum [NC,L]

#original 
RewriteRule ^sitemaps\.xml$ - [L]
RewriteRule ^sitemaps\.es\.xml$ - [L]
RewriteRule ^sitemaps\.forum\.xml$ - [L]
RewriteRule ^rssfeed\.xml$ - [L]

RewriteCond %{HTTP_HOST} !^(www|es|links|forum)\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteRule ^.*/img/(articles|fancybox|users)?/?(.*\.(jpg|gif|png|jpeg|bmp)) public/img/$1/$2 [NC,L]

RewriteRule uploader.php /public/uploader.php [NC,L]
RewriteRule ^.*$ /public/index.php [NC,L]

好吧,我希望有人可以帮助或者至少指出一些好的文档。顺便说一句:是的,我读了所有的apache文档!

问候!

0 个答案:

没有答案
相关问题