Tag: .htaccess

  • Redirecting all pages from the old domain to the new one

    When you switch domains for a WordPress installation, you should think of not only the how to move the site, but how to keep your content reachable by search engine hits or referrals. 301 Redirect is what is expected of you, and the easy way to do it, even if both domains are still hitting […]

  • Limiting access to (some) files in uploads dir

    All you need to do is add a .htaccess file with the following content in your uploads dir: [crayon-656ea82457b25608214199/] If you want to limit just any file from being accessed from anyone, just use “./*” instead of the regular expression.

  • Prevent hotlinking on your media files

    Whenever you want to ban/prevent hotlinking your media files and protect your server’s resources and bandwidth you may use the following snippet in the .htaccess file of your main directory of your site. [crayon-656ea82457cdd650581370/] Just replace YOURSITE.YOURDOMAIN with your site and at the fourth row of the actual code (don’t mind the # comment line) […]

  • .htaccess RewriteRule examples

    This is the source. I’m copying it for just in case it get’s lost for some reason. If http://example.com/foo/bar does not exist, redirect to http://other.example.com/foo/bar. (Put this in an .htaccess file in your top-level web directory.) [crayon-656ea824581f1539775875/] Handle all requests for top-level .html files and files with no extensions (http://example.com/foo,http://example.com/foo.html) with a single PHP program /foo/show.php. Also, ignore trailing characters in […]