最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

mod rewrite - htaccess redirect to path

programmeradmin1浏览0评论

I'm trying to get my site to redirect to a certain folder depending on a condition. This condition cannot be done within WP, so...

Anyway.. I've done conditions before, but I keep hitting a wall whenever I do a rewrite, since the site is a Wordpress site.

My redirect is:

RewriteCond %{HTTP_COOKIE} !JVL=NL;
RewriteCond %{REQUEST_URI} !^health-studies/
RewriteRule ^(.*)$ /health-studies/ [L,R,CO=JVL:NL:www.domain:7200:/]

So basically.. (depending on the condition of course), it needs to redirect to /health-studies/. Example: When people go to example, it needs to redirect to example/health-studies/

However.. I'm running into an error: ERR_TOO_MANY_REDIRECTS

What am I missing? (Must be something little..as always)

Additional htaccess code AFTER the above few lines:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain [NC,OR]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ /$1 [L,R=301]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
发布评论

评论列表(0)

  1. 暂无评论