0
我安装的WordPress上的/ var/vwww /从blog.example.net的WordPress上的子域和目录
访问博客这工作得很好,完美
然后,我也喜欢它是从WWW访问。 example.net/blog
至于结果,首先,我修改我的Apache虚拟主机条目做别名:
<VirtualHost *:80>
DocumentRoot /var/www/public_html
Alias /blog /var/vwww/blog
</VirtualHost>
其次,我修改/var/vwww/blog/.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.net$ [NC]
RewriteRule ^/blog/index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
RewriteCond %{HTTP_HOST} ^blog.example.net$ [NC]
RewriteRule ^/blog/index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
最后,我修改我的WordPress的wp-config.php文件
define('BASE_BLOG_URL', 'http://www.example.net/blog');
define('BASE_SITE_URL', 'http://example.net');
define('WP_HOME','http://www.example.net/blog');
define('WP_SITEURL','http://www.example.net/blog');
它适用于网址,如:
- blog.example.net
- www.example.net/blog
- www.example.net/blog/article-slug
而不是
- blog.example.net/article-slug
上面的网址是以前的工作,但现在我得到错误500,请帮助。
为什么你想要做的,而不是一个重定向到另一个呢? – janh
历史原因,大多数SEO和内部链接共享已经使用blog.example.net/article-slug 然后现在的要求要求改为example.net/blog/article-slug并期望两者同时工作 – exiang
Wouldn尽管重定向足够了吗?您仍然可以点击旧网址并重定向到内容。我已经看到规范标签配置多次崩溃,并且人们在谷歌以DC结束。 无论如何,你有权访问错误日志以查看实际错误是什么? – janh