dtjzpg5313 2018-04-06 21:59
浏览 137

Sitemap.xml没有加载它的调用index.php?page_url = sitemap.xml

So I have set up htaccess to pick up filenames e.g. /page.html and create the url /index.php?page_url=page and it works ok for all my pages but sitemap.xml isn't being found.

Instead it loads a plain html page with no content as it's returning index.php?page_url=sitemap instead of just loading the sitemap file which is in the root of the directory called sitemap.xml

Here is my htaccess file

RewriteEngine on

##### Security #####

## Keep people out of .inc files

<files *.inc.php>
order allow,deny
deny from all
</files>

<files *.inc.html>
order allow,deny 
deny from all
</files>

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>

## Deny index views of directories with no index file ##
Options -Indexes

# Ensure php pages cannot be viewed with the exception of /index.php
RewriteRule ^index.php$ - [L]

# ensure all pages end with a slash if there's no .xxx terminator
RewriteRule ^(([a-z0-9\-]+/)*[a-z0-9\-]+)$ /$1/%{QUERY_STRING [NC,R=301,L]

#fetch pages with no suffix and treat them as if they are html pages
RewriteRule ^([A-Za-z0-9|_|\-|\/]+)/$ /index.php?pageUrl=$1/&contentType=html&%{QUERY_STRING}  [L]

#fetch pages with a suffix and treat them as if they are the approriate page type
RewriteRule ^([A-Za-z0-9|_|\-|\/]+).([html|rss|xml|php]+)$ /index.php?page_url=$1&contentType=$2&%{QUERY_STRING} [L]

The .htaccess file is in the root alongside sitemap.xml and robots.txt which also has the full url of the sitemap in it so I'm not sure where I've gone wrong here

  • 写回答

1条回答 默认 最新

  • douyuan6490 2018-04-06 22:06
    关注

    I've taken xml out of the last line ([A-Za-z0-9|_|-|/]+).([html|rss|xml|php]+)$ and it works great now

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度