简体   繁体   中英

How to ignore htaccess folder from wordpress htaccess

I have this .htaccess file in Wordpress. It's located at /file_name/ (web root). I need to exclude a folder (booknow) from the rewrite engine.

I've tried this code:

RewriteRule ^/booknow($|/) - [L]

My Full .htaccess code given below:

#BEGIN WordPress

<IfModule mod_rewrite.c> 
    RewriteEngine On
    RewriteBase /file_now/
    RewriteRule ^/booknow($|/) - [L]
    RewriteRule ^index\.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /file_now/index.php [L]
 </IfModule>

#END WordPress

I tried this code but it didn't work.

试试这个代码:

RewriteRule ^(directory_name)($|/) - [L] 

Firstly assuming the br in your code are mistakes and not that you're writing HTML inside a .htaccess file.

The pattern in your rewrite rule has both a slash in the RewriteBase and the RewriteRule, so it's looking for something like /file_name//booknow/ You should instead type:

RewriteRule ^booknow($|/) - [L]

I got my own answer. I create a .htaccess File in WordPress directory booknow folder then I added below code to .htaccess file:

RewriteEngine on 
RewriteCond %{file_now/booknow} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
ErrorDocument 404 /file_now/booknow/404page.php

Now My Booknow folder is properly working.

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