0

I have a WP instance, and I see that any time I write a URL that has any string that contains moz it errors out with a 404.

I have taken a look at my .htaccess looking for moz and I see this:

RewriteCond %{REQUEST_URI} !^/moz(.*)

Why would that be causing a 404?

The context of this RewriteCond:

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/knowledge/
RewriteCond %{REQUEST_URI} !^/midphase(.*)
RewriteCond %{REQUEST_URI} !^/moz(.*)
RewriteCond %{REQUEST_URI} !^/Stats/(.*)
RewriteRule . /index.php [L]
3
  • Do the files exist? May 23 '14 at 2:51
  • 1
    Yes. It does exist. May 23 '14 at 2:57
  • 1
    If they exist then look in the error log, if there is nothing in the error log then make sure you LogLevel is set to Info or more verbose (Apache v2.4 only). If there is still nothing, then the request is still being rewritten somehow and you will probably need to enable logging for mod_rewrite, details here: wiki.apache.org/httpd/RewriteLog
    – Unbeliever
    Oct 30 '16 at 22:05
-1

What is happening here is that, all the URLs which contain /knowledge/ or /midphase or /moz or /Stats/ will show a 404. If you don't want that to happen remove these rules. Htaccess works using regular expressions to match.

Read here for more knowledge: Using .htaccess rewrite rules.

2
  • This is an overly simplistic view of what the block of rewrite conditions and the RewriteRule does. However explaining in full would not fit well at all into a comment.
    – Unbeliever
    Oct 30 '16 at 22:08
  • However, the OP has already stated that these files do exist and the first condition (ie. RewriteCond %{REQUEST_FILENAME} !-f) ensures that the request is only processed by this directive when the file does not exist. So, in this example, those directives should do nothing and the file should simply be served. So, something else must be going on here.
    – MrWhite
    Aug 4 '17 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.