[英]The htaccess file in my root is redirecting my wordpress site in my /apply/ directory to my root index. Help! :\
My domain is https://domainremoved.com/ . 我的域名是https://domainremoved.com/ 。 I installed some new software onto my site and it required that I enable mod_rewrite. 我在站点上安装了一些新软件,并且需要启用mod_rewrite。 It was already enabled on the server but I was told I had to also include it in my htaccess file. 它已经在服务器上启用,但被告知我还必须将其包含在htaccess文件中。 I also needed to install the software in the root of my site, where my wordpress blog originally was. 我还需要在我的wordpress博客最初所在的网站的根目录中安装该软件。 So I moved my Wordpress blog to a new directory, and named it /apply. 因此,我将Wordpress博客移至新目录,并将其命名为/ apply。 It was working fine, until I enabled mod_rewrite by adding this to the root htaccess file: 一切正常,直到我通过将其添加到htaccess根文件中启用了mod_rewrite为止:
DirectoryIndex router.php
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 ^(.*)$
RewriteRule ^(.*)$ router.php?_doroute=$1 [L,QSA]
Now, going to my Wordpress directory redirects to my root page. 现在,转到我的Wordpress目录将重定向到我的根页面。 Please help :\\ 请帮忙 :\\
Also, going to https://domainremoved.com/apply/contact-page/ and other pages all works. 另外, 请访问https://domainremoved.com/apply/contact-page/和其他页面。
This is the htaccess file info from my Wordpress directory (/apply): 这是我的Wordpress目录中的htaccess文件信息(/应用):
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /apply/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /apply/index.php [L]
</IfModule>
# END WordPress
I figured it out, thank God! 我想通了,感谢上帝! I just had to add /apply/index.php to the .htaccess file. 我只需要将/apply/index.php添加到.htaccess文件。 Here's how it looks like now: 这是现在的样子:
DirectoryIndex router.php /apply/index.php
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 ^(.*)$
RewriteRule ^(.*)$ router.php?_doroute=$1 [L,QSA]
Thanks everyone! 感谢大家!
Try removing the 3rd rewrite condition, then clear your browser cache. 尝试删除第三个重写条件,然后清除浏览器缓存。
Change your .htaccess in the root to: 将根目录中的.htaccess更改为:
DirectoryIndex router.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ router.php?_doroute=$1 [L,QSA]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.