我想用一个简单的 php 应用程序配置一个 Wordpress 应用程序。应用程序的目录结构如下:
根目录:/var/www/demoApp/
WordPress 目录:/var/www/demoApp/wordpress/
这里我想使用路由 http://BASE_URL/wordpress 访问 wordpress 应用程序.但是我无法配置 htaccess 文件。/var/www/demoApp/目录下的所有 php 页面都可以正常使用 url http://BASE_URL/ .虽然没有正确加载 wordpress 文件。
这是我的 Apache 配置 block :
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/demoApp
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/demoApp>
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
.htaccess 文件应该是什么?
最佳答案
我的配置:
域:test.localhost
wordpress 网址:test.localhost/wordpress
wordpress文件夹下的.htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
子域的Apache设置(windows下的Wamp服务器)
<VirtualHost *:80>
DocumentRoot "e:\Sync\www\test"
ServerName localhost
ServerAlias test.localhost
<Directory "e:\Sync\www\test">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
</Directory>
</VirtualHost>
关于php - 如何使用 .htaccess/Apache2 在子目录中配置 wordpress 应用程序和简单的 php 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44565032/