[OR] flag on [Rewrite/seo] cond

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 14
Joined: 11 Jun 2014, 10:50

[OR] flag on [Rewrite/seo] cond

17 Sep 2014, 05:09

Hi! I've noticed that if i write a sequence of SeoCond and RewriteCond like this:

SeoCond %{REQUEST_URI} home [NC,OR]
SeoCond %{REQUEST_URI} Site_map [NC, OR]
SeoCond %{REQUEST_URI} About_us [NC, OR]
SeoCond %{REQUEST_URI} Service [NC, OR]
SeoCond %{REQUEST_URI} Sales_network [NC, OR]
SeoCond %{REQUEST_URI} News_Events [NC, OR]
SeoCond %{REQUEST_URI} Contacts [NC]

Seorule ^(.+)\.asp(.*)$ $1.html$2 [Redirect]


RewriteCond %{REQUEST_URI} home [NC,OR]
RewriteCond %{REQUEST_URI} Site_map [NC, OR]
RewriteCond %{REQUEST_URI} About_us [NC, OR]
RewriteCond %{REQUEST_URI} Service [NC, OR]
RewriteCond %{REQUEST_URI} Sales_network [NC, OR]
RewriteCond %{REQUEST_URI} News_Events [NC, OR]
RewriteCond %{REQUEST_URI} Contacts [NC]

RewriteRule ^(.+)\.html(.*)$ $1.asp$2 [NC,NS]

the URI that aren't present in the seo/rewrite Cond are transformed in the same way, although this is not the behaviour that i needed. There are a way to solve this problem? Thank you very much!

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: [OR] flag on [Rewrite/seo] cond

17 Sep 2014, 09:31

Hello,

I suggest you to use the shorter (and I believe better working) structure:

SeoCond %{REQUEST_URI} (?:home|Site_map|About_us|Service|Sales_network|News_Events|Contacts) [NC]
Seorule ^(.+)\.asp(.*)$ $1.html$2 [Redirect]

RewriteCond %{REQUEST_URI} (?:home|Site_map|About_us|Service|Sales_network|News_Events|Contacts) [NC]
RewriteRule ^(.+)\.html(.*)$ $1.asp$2 [NC,NS]

User avatar
Posts: 14
Joined: 11 Jun 2014, 10:50

Re: [OR] flag on [Rewrite/seo] cond

17 Sep 2014, 11:34

I've tried to insert the Seo/Rewrite cond like this (I've hard copy it in the .htaccess file) but the page had generate a redirecting loop. Any other suggestion? Meanwhile, I read the documentation in case of my error. Thank you very much!

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: [OR] flag on [Rewrite/seo] cond

18 Sep 2014, 02:48

Hello,

I guess the syntax for RewriteRule is incorrect, please try to fix it like this:

RewriteBase /

SeoCond %{REQUEST_URI} (?:home|Site_map|About_us|Service|Sales_network|News_Events|Contacts) [NC]
SeoRule ^(.+)\.asp(.*)$ /$1.html$2 [Redirect]

RewriteCond %{REQUEST_URI} (?:home|Site_map|About_us|Service|Sales_network|News_Events|Contacts) [NC]
RewriteRule ^(.+)\.html$ /$1.asp [NC,NS,QSA]

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 0 guests