2016-02-12 153 views
1

我有一个angularJS站点,并且.htaccess文件已被配置为将所有流量从mysite.se/*重定向到mysite.se/index.html。.htaccess:允许特定的URL

它还配置了prerender.io让搜索引擎访问该网站。

问题:我想添加一个博客到blog.mysite.se,问题当然是它会被重定向到mysite.se/index.html。我需要添加到.htaccess文件才能通过blog.mysite.se?

感谢

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^MYSITE\.se$ [NC] 
RewriteRule ^.*$ http://www.MYSITE.se%{REQUEST_URI} [R=301,L] 


# If requested resource exists as a file or directory 
# (REQUEST_FILENAME is only relative in virtualhost context, so not usable) 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d 
# Go to it as is 
RewriteRule^- [L] 

# If non existent 
# If path ends with/and is not just a single /, redirect to without the trailing/
RewriteCond %{REQUEST_URI} ^.*/$ 
RewriteCond %{REQUEST_URI} !^/$ 
RewriteRule ^(.*)/$ $1 [R,QSA,L]  

# Handle Prerender.io 
RequestHeader set X-Prerender-Token "kEJ0CC1gMnj6V0J4u8xu" 

RewriteCond %{HTTP_USER_AGENT} baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest [NC,OR] 
RewriteCond %{QUERY_STRING} _escaped_fragment_ 

# Proxy the request 
RewriteRule ^(.*)$ http://service.prerender.io/http://%{HTTP_HOST}$1 [P,L] 

# If non existent 
# Accept everything on index.html 
RewriteRule^/index.html 

回答

1

插入此规则略低于RewriteEngine On线从当前规则跳过blog子域名:

RewriteEngine On 

RewriteCond %{HTTP_HOST ^blog\. [NC] 
RewriteRule^- [L] 

# rest of rules here