我试图在我的机器上为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的相对网址
但是,当我访问http://myapplication.dev时,我网站的第一页就在那里,但没有一个链接有效!他们都发送了一个500错误页面
答案 0 :(得分:0)
好的,通过以下链接找到了解决方案: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]