简体   繁体   中英

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/ . I installed some new software onto my site and it required that I enable mod_rewrite. It was already enabled on the server but I was told I had to also include it in my htaccess file. I also needed to install the software in the root of my site, where my wordpress blog originally was. So I moved my Wordpress blog to a new directory, and named it /apply. It was working fine, until I enabled mod_rewrite by adding this to the root htaccess file:

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. Please help :\\

Also, going to https://domainremoved.com/apply/contact-page/ and other pages all works.

This is the htaccess file info from my Wordpress directory (/apply):

# 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. 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:

DirectoryIndex router.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ router.php?_doroute=$1 [L,QSA]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM