Hot answers tagged

4

how this workaround indeed works PHP runs later in the request, so most of the time you can simply override any headers that Apache has already set in your PHP code. That's pretty much it. (Aside: Sending 403s through your 404 handler in this way obviously makes it harder to trigger a real 403 from your Apache config/.htaccess, if you should need to.) ...


4

Server version: Apache/2.4.12 (Win32) Is it possible to make website a variable? Not before Apache 2.4.13 unfortunately. Can .htaccess auto detect the SubFolder (including SubFolder depth)? This depends on the module you are using in .htaccess, rather than .htaccess itself. For instance, mod_rewrite (when used in a per-directory context) ...


3

People often forget about using symlinks. You can create a symlink for each site that points to a single directory. This means that a relative URI of /error/error404.html can all point to the same directory/file even outside of the/any web root. This answer on another SE site covers the topic enough to get started: ...


3

RewriteRule ^lp/?$ /index.php [L] This fails to match because your actual URL is probably /lp/index.php (or whatever your DirectoryIndex is), not simply /lp/. (That is after Apache has internally mapped the URL to a filesystem path). So, try changing your RewriteRule pattern: RewriteRule ^lp/index\.php$ /index.php [L] Specifically, there is a ...


2

If you do not specifically have a dedicated IP address from GoDaddy then you are being hosted on a shared IP address. GoDaddy doesn't give each client a dedicated IP address and instead uses IP addresses that are shared to host multiple client sites on a single address. Because of this if you try and view one of these shared addresses in your browser you ...


2

301 redirection is a suggested method if you have almost similar content on the page you are redirecting to. Otherwise google penalizes that and considers that a soft 404, where-in the site is misleading the users. So you can redirect some urls i.e. apple-to-apple mapping, but don't redirect everything to a single home page. Rather add a 410 permanently ...


2

Redirecting lot of pages which is having good SEO value to a single page website may not be a good idea. Consequently you lose SEO value for the old website. IMO Just use the website for advertising purpose of new website. Place a good banner. Offer something..


2

Just keep it like that, clean. It's quite easy to remove index.html from a URL with mod_rewrite. Let's say we want to redirect www.example.com/index.html to www.dense13.com: RewriteEngine On RewriteRule ^index\.html$ / [R=301,L] If you're not familiar with .htaccess syntax the RewriteRule directive has three parts, a pattern (^index.html$), a ...


2

i want to make infinite redirection because i dont want facebook bot crawl my site. if do in the normal way, the facebook also trace my website, and when I share in highly frequency mysite on facebook then my website will be blocked. if make facebook bot stuck in redirect it can not trace mysite – Sheng Long That tactic'll work perfectly, if you want to ...


2

To combine those three rules into one you can use alternation (with a vertical bar) in a capturing group and another backreference in the substitution: For example: RewriteRule ^(information|reviews|comments)/business-name/(.*)$ /$1/new-business-name/$2 [R=301,L] $1 is now a backreference to either "information", "reviews" or "comments". Depending on ...


2

Here is the shorter version of your code : RewriteEngine on RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R]


2

I solved this problem via : RewriteCond %{HTTP_HOST} ^(www\.example\.com)(:80)? [NC] RewriteRule ^(.*) https://example.com/$1 [R=301,L] RewriteCond %{SERVER_PORT} 80 [NC] RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]


1

As a work around, I am proxying the web service: My SSL Hosting (Angular Project + Newly created proxy web service) AWS (Old Web service + MySql Database) From angularJS i call newly created proxy (that just uses cURL). This cURL code passes request to AWS server over HTTP.


1

I tried to add this into .htaccess file: RewriteEngine On RewriteCond %{HTTP_USER_AGENT} (facebookexternalhit|FacebookExternalHit|Facebot) [NC] RewriteRule ^(.*)$ ^$1 [R=302] As already stated you don't "redirect", and certainly don't try to create an "infinite redirect", in order to block traffic. Purposefully creating an "infinite redirect" for any ...


1

My hypothesis on the 5429 errors is that Google is trying to parse an HTML doc, (i.e., the redirect is working, but ending up in the wrong place). Could be a 404 page, an error page or even the home page. I had this very problem yesterday where the http://example.com/robots.txt was redirecting to /index.php and then again to my home page due to a dodgy ...



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