What can create RewriteRule to function just for sure web pages?

Exist any kind of exterior variables (that is, not in the .htaccess documents) that can create the RewriteRule not to benefit details URLs (of existing web pages)?

I have the adhering to code in the .htaccess documents (it executes redirection yet except all URLs) :

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php

RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$
RewriteRule (.*) http://example.com/$1 [R=301,L,QSA]
</IfModule>

[Edit ] I've currently made some adjustments given that I first uploaded the inquiry, adjustments that really did not bring any kind of renovation when it come to the means redirections are made - so the trouble still requires a remedy.

The entire .htaccess documents web content is :

Options +FollowSymLinks -MultiViews

RewriteEngine on

AddHandler x-httpd-php .html .htm

<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

<ifModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType text/html "access plus 1 seconds"
  ExpiresByType image/gif "access plus 2592000 seconds"
  ExpiresByType image/jpeg "access plus 2592000 seconds"
  ExpiresByType image/png "access plus 2592000 seconds"
  ExpiresByType text/css "access plus 2592000 seconds"
  ExpiresByType text/javascript "access plus 216000 seconds"
  ExpiresByType application/x-javascript "access plus 216000 seconds"
</ifModule>

<ifModule mod_headers.c>
  <filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
    Header set Cache-Control "max-age=2592000, public"
  </filesMatch>

  <filesMatch "\\.(css)$">
    Header set Cache-Control "max-age=2592000, public"
  </filesMatch>

  <filesMatch "\\.(js)$">
    Header set Cache-Control "max-age=216000, private"
  </filesMatch>

  <filesMatch "\\.(xml|txt)$">
    Header set Cache-Control "max-age=216000, public, must-revalidate"
  </filesMatch>

  <filesMatch "\\.(html|htm|php)$">
    Header set Cache-Control "max-age=1, private, must-revalidate"
  </filesMatch>
</ifModule>

<ifModule mod_headers.c>
  Header unset ETag
</ifModule>

FileETag None    

<ifModule mod_headers.c>    
  Header unset Last-Modified
</ifModule>

RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$
RewriteRule .? http://example.com%{REQUEST_URI} [R=301,L]

#BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
# END WordPress
0
2019-12-02 02:55:53
Source Share
Answers: 1

Old Answer

. htaccess revises job from the top down. As soon as a re - write suit has actually been located after that apache quits there. So you require to place your re - instructions first similar to this :

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$
RewriteRule (.*) http://domain.com/$1 [R=301,L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php

</IfModule>

New Answer

as opposed to :

RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$
RewriteRule .? http://domain.com%{REQUEST_URI} [R=301,L]

attempt :

    RewriteCond %{HTTP_REFERER} !^http://(.+\.)?domain\.com/ [NC]
    RewriteRule (.*) http://domain.com/$1 [R=301,L]

Or if that does not function attempt :

    RewriteCond %{HTTP_REFERER} !^http://(.+\.)?domain\.com(.+)? [NC]
    RewriteRule (.*) http://domain.com/$1 [R=301,L]
0
2019-12-03 04:34:08
Source