Hot answers tagged

8

...in case the webhoster disabled the use of .htaccess files? If the webhost has disabled the use of .htaccess files then there is no direct alternative. (.htaccess = per-directory Apache config file) .htaccess files are not necessary if you have access to the Apache server config. In fact, it is preferable to use the server config instead of .htaccess ...


3

In order to match the query string (ie. page_id=123 part) you need a RewriteCond directive and the QUERY_STRING server variable (from mod_rewrite). Try something like the following in the /abc/.htaccess file (ie. in the subdirectory you want to redirect from): RewriteEngine On RewriteCond %{QUERY_STRING} ^page_id=123 RewriteRule ^$ /xyz/newindividualpage/ [...


1

You'll need to use mod_rewrite (as opposed to a mod_alias Redirect) and check the HTTP_HOST server variable (which tells you which site has been accessed). Something like the following at the top of your .htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?website1\.com$ [NC] RewriteRule ^example/(.*)$ http://www.website2.com/example/$1 [R=302,...


1

It's been a long time since I've used Apache and I don't use PHP but ... You can set your own HTTP headers, redirect, and just about everything else within a programming environment that doesn't block you from accessing those files. I don't recall where in the flow .htaccess is looked at when PHP pages are executed but you would need to find out, by ...


1

As far as I know, there are no alternatives. Seems this topic was discussed from another angle : Alternative to .htaccess (due to bad performance?)


1

I've started using the following code: RewriteCond %{HTTP_REFERER} ^http://.*[bad_referrer]\.com/ [NC] RewriteRule ^(.*)$ – [F,L] This looks for the referrer, in your case semalt.com, and creates a bad request. If you want to add more conditions use [NC,OR] until you get to the last item. If mod_rewrite isn't available, this technique will not work. You ...


1

This isn't a direct answer to your question but to your problem: Try a hostname filter on your Analytics account instead. Filter only for your domain. The only situation in which you'll get views without your domain being the hostname is if you're serving content on other domains - such as via an iFrame. When it comes to crawlers, there's many techniques. ...


1

Here are some redirect options you can use in .htaccess. These cover various cases of raw IP, the IP somehow mucked with www, util host subdomain (for addon domain), target www mode, target HTTPS mode, etc. This will also preserve any URi's instead of just dumping to a static homepage or whatever. Swap/edit the last 2 lines for www and HTTPS mode: ...


1

If you do not want the site to respond to the IP Address I would implement a virtual host in Apache. Set the virtual root to a different directory of the Apache server. Now all traffic defaults to a different location of your manned site. Otherwise as already noted I would use a redirect. Personally I would use the htaccess style. After tested in the ....


1

Easy. Just make a redirect from the IP address to the domain name. Method 1 A nice way to do it if your server supports it is to create a PHP file containing the following: <?php header("HTTP/1.1 301 Redirect",true); header("Location: http://example.com",true) ?> <html><head><title>Redirect</title><body> <a href="...


1

See the following from CloudFlare: How do I fix the infinite redirect loop error after enabling Flexible SSL with WordPress? Some users may experience redirect loops after activating CloudFlare’s free Universal Flexible SSL option. In order to fix this issue and/or get things set please follow the steps outlined below: ** WordPress Site ** 1. Install ...



Only top voted, non community-wiki answers of a minimum length are eligible