【问题标题】:Links on virtualhost with Xampp not working带有 Xampp 的虚拟主机上的链接不起作用
【发布时间】:2016-10-23 08:38:52
【问题描述】:

我正在尝试在我的机器上为 wordpress 项目设置一个虚拟主机

我在 Apache 的 http-vhosts.conf 中添加了这个

<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\wordpresstest"
ServerName myapplication.dev
<Directory "C:\xampp\htdocs\wordpresstest">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>
</VirtualHost>

我在 windows 主机文件中添加了这一行

127.0.0.1             myapplication.dev

我在 wp-config 中添加了这些行

define('WP_HOME','http://myapplication.dev');
define('WP_SITEURL','http://myapplication.dev');

我还添加了一个插件以允许跨 wordpress 的相对 URL

但是,当我访问http://myapplication.dev 时,我的网站的第一页在那里,但没有一个链接有效!他们都发送一个 500 错误页面

【问题讨论】:

  • 500 错误是网络服务器表示“我有一个大问题,但我不想公开谈论它”的方式。查看服务器的错误日志,会有一个明确的信息说明出了什么问题。
  • 你是对的!它说:“由于可能的配置错误,请求超出了 10 个内部重定向的限制。如有必要,请使用 'LimitInternalRecursion' 增加限制。使用 'LogLevel debug' 获取回溯。引用者:myapplication.dev

标签: wordpress xampp virtualhost


【解决方案1】:

好的,通过这个链接找到了解决方案:https://gist.github.com/JustThomas/141ebe0764d43188d4f2

我更改了我的 .htaccess 文件

之前:

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

# END WordPress

之后:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

【讨论】:

    猜你喜欢
    • 2014-05-30
    • 1970-01-01
    • 2011-04-26
    • 2016-11-27
    • 2013-09-11
    • 2020-03-27
    • 2018-02-18
    • 2012-08-27
    • 2020-09-11
    相关资源
    最近更新 更多