Wordpress 301重定向.htaccess borks我的网站

时间:2014-08-22 00:44:00

标签: apache .htaccess redirect

我正在从Wordpress转向Statamic。我的Statamic站点需要一个.htaccess文件,一切正常,直到我尝试进行映射。

我之前的网址是:thedalzells.org/2014/08/post-title,新的网址是thedalzells.org/blog/post-title。

Removing date from url using .htaccess我创建了这个:

# Turn on the Rewrite Engine
RewriteEngine On

# If you're running in a subfolder (like http://example.com/statamic),
# add that here. E.g. /statamic/
RewriteBase /

# Protect your system files from prying eyes
RewriteRule ^(_app) - [F,L]
RewriteRule ^(_config) - [F,L]
RewriteRule ^(_cache) - [F,L]
RewriteRule ^(_content) - [F,L]
RewriteRule ^(_logs) - [F,L]
RewriteRule ^(admin/themes/[^/]*/(?:layouts|templates)) - [F,L]
RewriteRule ^(.*)?\.yml$ - [F,L]
RewriteRule ^(.*)?\.yaml$ - [F,L]
RewriteRule ^(.*/)?\.git+ - [F,L]

# This will prevent all .html files from being accessed.
# You may want to remove this line if you want to serve
# static files outside of Statamic
RewriteRule ^(.*)?\.html$ - [F,L]

# Remove trailing slashes from your URL
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]

# Redirect from old URLS
RewriteRule  /\d{4}/\d{2}/(.*) $1 [R=301, L]

# Remove the index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]

如果我这样做,我的网站上没有任何作品。求救!

1 个答案:

答案 0 :(得分:0)

删除了前导斜杠并添加到正确的目标' / blog $ 1'一切都很好。