我想要创build使用.htaccess的URL的redirect
http://shows.example.com/showtitle/sitemap.xml
映射到我现有的文件夹结构是什么样的
http://shows.example.com/sitemaps/sitemap_shows_showtitle_3day.xml
两个variables可以不同的子域和显示标题
所以我写了
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com$ RewriteCond %{REQUEST_URI} ^/([az]*)/sitemap.xml RewriteRule ^(.*)$ http://%1.example.com/sitemaps/sitemap_%1_$1_3day.xml [L]
redirect到
http://superstar.example.com/sitemaps/sitemap_superstar__3day.xml
我是否需要将两个RewriteCond合并为一个来访问这两个variables? 或者我可以从这些variables中获得variables吗?
pipe理得到这样的工作。
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com$ RewriteRule ^([az]*)/sitemap.xml http://%1.example.com/sitemaps/sitemap_%1_$1_3day.xml [L,R=302]