robots.txt, .htaccess redirects not updating properly

I’ve noticed a few bugs on a few files on a site I am helping a friend with that are not updating properly.

1) when I update my robots.txt file, the changes do not take place;

Read More

2) I made a redirect in my .htaccess to direct non-www to www version, however when I comment out these lines of code the redirect still works;

3) A couple weeks ago I put in a redirect on my .htaccess to direct mobile users to my m.domain site, which worked, however now when my JS files have the ? query string removed, these files get redirected to the exact same file path except now on the mobile version. For example, example.js?ver=4.2 works fine, but example.js will redirect to m.filepath/example.js.

I’m stumped as to why this could be happening. This is all taking place without any cache program, and on multiple browsers. It’s like there’s some kind of phantom code monster hidden in my back end sent to piss me off :<

Here’s my .htaccess if that helps:

# numerous 301 redirect's above rest of .htaccess here
# BEGIN WordPress

<files wp-config.php>
order allow,deny
deny from all
</files>

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

#<IfModule mod_rewrite.c>
#RewriteEngine On
#RewriteBase /
#AddDefaultCharset UTF-8
#RewriteCond %{HTTP_HOST} ^renaissanceeuropeanspa.com
#RewriteRule ^(.*)$ http://www.renaissanceeuropeanspa.com/$1 [R=301,L]
#</IfModule>

# Enable Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
</IfModule>
<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>
# Leverage Browser Caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 1 month"
</IfModule>
<IfModule mod_headers.c>
  <filesmatch ".(ico|flv|jpg|jpeg|png|gif|css|pdf|swf)$">
    Header unset ETag
    FileETag None   
    Header set Cache-Control "max-age=604800, public"
  </filesmatch>
  <filesmatch ".(js|php)$">
    Header unset ETag
    FileETag None
    Header set Cache-Control "max-age=604800, private"
    Header set Last-Modified "Mon, 14 Nov 2015 01:00:00 GMT"
  </filesmatch>
</IfModule>
<IfModule mod_headers.c>
    Header set Connection keep-alive
</IfModule>
# END WordPress

Related posts

1 comment

  1. How are you accessing your files?

    I just had a similar issue (changes to .htaccess having no effect after an initial successful change this morning). I was modifying the file locally and pushing via FTP.

    My FTP client was showing the edited file on the server, and if I intentionally invalidated the .htaccess file (entered junk characters) and uploaded, viewing the site in a browser gave the expected 500 error right away.

    The solution that worked for me: Access the files via ssh.

    Doing so showed the .htaccess file as it was after the initial change, with an ‘updated’ timestamp from that change, no evidence of the further edits that had been done since this morning.

    I made my edits directly using vim, saved, and checked the site. The changes worked. Viewing the file via an FTP client showed the newest version.

    I was able to confirm with the hosting company that there appears to be something wrong with my hosting account (or account permissions?), which might explain why updates via FTP weren’t working as expected.

Comments are closed.