简体   繁体   English

我根目录中的htaccess文件正在将我/ apply /目录中的wordpress网站重定向到我的根目录索引。 救命! :\\

[英]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.

相关问题 如何告诉子域的索引调用子目录的index.php文件中根目录的全部内容? - How do I tell the index of my subdomain to call the entire contents of the root directory in the index.php file of my sub-directory? 为什么 IIS 不执行我的站点根 index.php 文件的 PHP 代码? - Why isn't IIS executing the PHP code of my site root index.php file? htaccess更改我的域之一的根文件夹 - htaccess Change the root folder for one of my domain 为什么我的WordPress网站重定向到错误的URL? - Why is my WordPress site redirecting to incorrect URL? 如何忽略所有路径名,并将index.php加载到网站的根目录? - How do I ignore all pathNames and load my index.php at the root of my site? ModX / PHP:在连接数据库的根目录中有我自己的文件吗? - ModX/PHP: Have my own file in root directory that connects to DB? 对 .htaccess 文件的更改不断使我的 Wordpress 站点崩溃 - Changes to .htaccess file keep crashing my Wordpress site 如何在XAMPP中更改目录根目录 - How to change my directory root in XAMPP 上传我的网站(根目录)时出现问题 - Problems uploading my website (root directory) 仅在我的目录中而不是在根存储库中获取修订 - Getting Revisions ONLY in my directory and not in root Repository
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM