0

I want to serve wordpress from public_html/blog. I have already install zend framework and i would like to know how to achieve this. My .htaccess file looks like

RewriteEngine On

RewriteRule ^\.htaccess$ - [F]

RewriteCond %{HTTP_HOST} ^domain\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain\.example\.com$
RewriteRule ^/?$ "http\:\/\/simple\.com\/" [R=302,L]

RewriteCond %{HTTP_HOST} ^other\-domain\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.other\-domain\.example\.com$
RewriteRule ^/?$ "http\:\/\/simple\.com\/" [R=302,L]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ public/index.php [NC,L]

RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

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

I am totaly green in htaccess files and this is my first case with it. Is that structure already correct?

4

1 回答 1

0

在您的 ZF htaccess 中,允许 apache 为现有文件和目录提供服务:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

现在 apache 会看到 /blog 是一个真正的文件夹,然后当用户转到 /blog 时,会在其中加载 htaccess(您的 WP htaccess)。

您应该能够将两个 htaccess 规则分开,而无需复杂的路由

于 2013-03-22T15:57:35.463 回答