帖子将被重定向至XAMPP主页

时间:2013-01-10 作者:Baig

我有一个wordpress站点,我从live下载并在本地使用xampp进行配置。当我点击任何帖子时,它会将我重定向到localhost/xampp 而不是post pagemy。htaccess就像

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# 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>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon
</IfModule>
</IfModule>
<FilesMatch "\\.(css|js|htc|CSS|JS|HTC)$">
FileETag None
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.2.4"
</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 set X-Powered-By "W3 Total Cache/0.9.2.4"
</IfModule>
</FilesMatch>
<FilesMatch "\\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|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|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 set X-Powered-By "W3 Total Cache/0.9.2.4"
</IfModule>
</FilesMatch>
# END W3TC Browser Cache
# BEGIN W3TC Page Cache core
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*\\/)?w3tc_rewrite_test$ $1?w3tc_rewrite_test=1 [L]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=W3TC_ENC:_gzip]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP_HOST} =highimpactdataindex.com
RewriteCond %{REQUEST_URI} \\/$ [OR]
RewriteCond %{REQUEST_URI} (sitemap(_index)?\\.xml(\\.gz)?|[a-z0-9_\\-]+-sitemap([0-9]+)?\\.xml(\\.gz)?) [NC]
RewriteCond %{REQUEST_URI} !(\\/wp-admin\\/|\\/xmlrpc.php|\\/wp-(app|cron|login|register|mail)\\.php|\\/feed\\/|wp-.*\\.php|index\\.php) [NC,OR]
RewriteCond %{REQUEST_URI} (wp\\-comments\\-popup\\.php|wp\\-links\\-opml\\.php|wp\\-locations\\.php) [NC]
RewriteCond %{HTTP_COOKIE} !(comment_author|wp\\-postpass|wordpress_\\[a\\-f0\\-9\\]\\+|wordpress_logged_in) [NC]
RewriteCond %{HTTP_USER_AGENT} !(W3\\ Total\\ Cache/0\\.9\\.2\\.4) [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/w3tc/pgcache/%{REQUEST_URI}/_index%{ENV:W3TC_UA}%{ENV:W3TC_REF}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" -f
RewriteRule .* "/wp-content/w3tc/pgcache/%{REQUEST_URI}/_index%{ENV:W3TC_UA}%{ENV:W3TC_REF}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" [L]
</IfModule>
# END W3TC Page Cache core
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

3 个回复
最合适的回答,由SO网友:s_ha_dum 整理而成

您的重写规则错误。现有规则适用于站点位于根目录时--http://localhost. 您的网站位于http://localhost/highimpact. 我认为最终的重写规则应该是,RewriteRule . /highimpact/index.php [L].

如果您转到wp admin->Permalinks并保存设置,WordPress将重写规则或告诉您规则需要是什么,如果.htaccess 服务器无法写入。试试看,万一我猜错了。

我不知道缓存规则需要做什么。我想缓存插件也有类似的机制来重写它的规则,但我不知道如何做到这一点。

SO网友:Ruhul Amin

我想,您从localhost获取了数据库。如果是这样,请转到phpmyadmin并单击wp\\u选项表。在该表的第一行,您将看到option\\u value“localhost/directory”按当前站点url更改它。

SO网友:Kerim

转到您的站点/wp管理设置,然后更改为普通设置

结束

相关推荐

将特定帖子包括到QUERY_POSTS中,如果该帖子已在返回列表中则将其删除

与我赤裸。首先,这是我的特色滑条文章的完整脚本:<div id=\"featured\" class=\"<?php if ( $responsive ) echo \'flexslider\' . $featured_auto_class; else echo \'et_cycle\'; ?>\"> <a id=\"left-arrow\" href=\"#\"><?php esc_html_e(\'Previous\',\'Aggregate\');