如何在静态网站内的文件夹中设置wp?

时间:2013-05-08 作者:user5057

在我的服务器中,我有以下文件结构:

www/
  index.html
  js/..
  css/..
  img/..
  index.html
  ...
  blog/
    .htaccess
    index.php
    wordpress/
      .htaccess
      wp-config.php
      ...
基本上,www/有一些静态文件和我保存wordpress文件的blog/目录(因此,如果我想登录,我必须访问www.mysite.com/blog/wordpress/wp admin.php)

我登录没有问题,显示首页也没有问题,但当我尝试访问某个帖子或类别时,我会被重定向到www.mysite。com/索引。php并获取以下错误消息:

Not Found

The requested URL /index.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
我不认为这是一个。htaccess问题,因为两者都存在。htaccess文件在那里,我在本地浏览网站时没有任何permalinks问题。。。有什么想法吗?

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
    <IfModule mod_setenvif.c>
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\\.0[678] no-gzip
        BrowserMatch \\bMSIE !no-gzip !gzip-only-text/html
        BrowserMatch \\bMSI[E] !no-gzip !gzip-only-text/html
    </IfModule>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
        AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_mime.c>
        # DEFLATE by extension
        AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
</IfModule>
<FilesMatch "\\.(css|htc|js|js2|js3|js4|CSS|HTC|JS|JS2|JS3|JS4)$">
    FileETag None
    <IfModule mod_headers.c>
         Header unset ETag
    </IfModule>
</FilesMatch>
<FilesMatch "\\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|SVGZ|TXT|XSD|XSL|XML)$">
    FileETag None
    <IfModule mod_headers.c>
         Header unset ETag
    </IfModule>
</FilesMatch>
<FilesMatch "\\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|WAV|WMA|WRI|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
    FileETag None
    <IfModule mod_headers.c>
         Header unset ETag
    </IfModule>
</FilesMatch>
# END W3TC Browser Cache


# BEGIN W3TC Page Cache core
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteRule .* - [E=W3TC_ENC:_gzip]
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{REQUEST_URI} \\/$
    RewriteCond %{HTTP_COOKIE} !(comment_author|wp\\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
    RewriteCond %{HTTP_USER_AGENT} !(W3\\ Total\\ Cache/0\\.9\\.2\\.9) [NC]
    RewriteCond "%{DOCUMENT_ROOT}/wordpress/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index.html%{ENV:W3TC_ENC}" -f
    RewriteRule .* "/wordpress/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index.html%{ENV:W3TC_ENC}" [L]
</IfModule>
# END W3TC Page Cache core

1 个回复
SO网友:Ben Cole

听起来你需要复制文件/blog/index.php/index.php 并在创建的新副本中修改一行:

require(\'./wp-blog-header.php\');

require(\'./wordpress/wp-blog-header.php\');
以下是将Wordpress移动到单独文件夹的完整指南:http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

结束

相关推荐

Modrewrite在我的apache设置上不起作用

不确定这是站长问题还是WordPress问题,这有点半斤八两,如果我在错误的地方发帖,很抱歉。如果不在二级域中使用多站点或安装新的WordPress CMS,在我的VPS上运行多个WordPress安装的最佳方法是什么?它目前正在工作,但只能通过将permalinks选项设置为默认设置来实现,因此URL不是人性化的。我遇到了一个叫WPSiteStack, 虽然我真的不想走这条路。长话短说,我需要以下内容:单独安装,这样一个核心/主题/插件更新不会影响所有站点,并提高所有站点的安全性</“美丽”的长相