Tag Info

New answers tagged

0

<rule name="everything to index"> <match url="^(.*)$" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php?q={R:1}" /> </rule>


0

Apache is really, really bad at filtering any kind of requests due to its design (by the time it can learn about the request and drop it or respond with an error, it already used a lot of resources and stuff). What I did and had a big success with was this: Install mod_rpaf or similar in Apache and set it to accept proxy from localhost. Install haproxy on ...


0

Actually, a friend help me out with this. RewriteRule ^test.html http://www.example.com/index#test [R=301,NE,L]


0

EDIT: The real solution to this problem is not putting rewrite rule for proxy to php-fpm in but to do the following: RewriteCond %{REQUEST_URI} -U RewriteRule (.*\.php)$ fcgi://IP:PORT/$1 [P,L] Outside of the tags and inside of the tags. As original solution had a problem: if there was "RewriteEngine On" or any "RewriteRule" related rules/conditions ...


1

It appears you pass all your php execution to your fast cgi server which does not know how to use htaccess so that's why it ignores those files. If you need to use htaccess files by Apache, then you need to execute php scripts by Apache (i.e. using mod_php) instead of passing execution to another service which has no idea about htaccess. You could re-do ...


3

In my opinion your optimizing the wrong thing by strictly forcing certain pages to use HTTPS and other to use plain HTTP. Simply redirect everything to HTTPS and be done with it. The computational cost of HTTPS is negligible in most cases. Your concern about browser cache with SSL seems unfounded as well. And my pet peeve: you're better off including ...


0

You cannot achieve the goal you want in nginx. You have to make the redirection inside your application, that is, add the code to page=login part of the app.


1

You should be able to add more patterns: RedirectMatch 403 /(\{\$itemURL\}|cro|HNAP1|wp|blog|wp/wp-admin|blog/wp-admin|wp/wp-admin/.+|)/?$ Hope this helps.


1

You do not have to specify RewriteCond if you could specify the match in RewriteRule. For example: # /xx/somepage.php -> /somepage.php?ln=xx INTERNAL REWRITE RewriteCond %{REQUEST_URI} ^/../.+ [NC] RewriteRule ^(en|de)/(.*) $2?ln=$1&%{QUERY_STRING} [L] Should work with just: # /xx/somepage.php -> ...


0

You just put $ at the end of the RewriteRule, but you'll want the first capture group of your regex (the .* bit of ^(.*)$). That is fetched with $1, also mind you'll still need a trailing slash at the end. So, all in all, update your rule to: RewriteRule ^(.*)$ http://www.example.net/subdirectory/$1 [L,R=301] http://www.example.com/link.php?a=1&b=1 ...


1

You must perform a negative lookahead and capture. The correct RewriteRule will look something like this: RewriteRule ^(category1|category2)\/(.*)\/((?!p[0-9]+|view-all|low-to-high|high-to-low).*)$ /product/detail/$3


0

It turns out I had to turn on mod_rewrite (a2enmod rewrite) and the .php file had errors that I couldn't see, for which I used: <?php error_reporting(E_ALL); ini_set("display_errors", 1); include("file_with_errors.php"); ?> From the php manual site, on this page: http://www.php.net//manual/en/function.error-reporting.php Also, if you'd like to ...


1

There is no limit on the size of a .htaccess file other than the OS file size limits (usually 2GB or more). However, there are major performance implications involved in using .htaccess files because of the way that Apache processes them recursively (traversing the directory tree up) on every page load. In fact, Apache recommends against using .htaccess ...


2

You should do it at whatever level you want it to apply, be that individual sites or site wide. The better way, however, is to put it in Apache's configuration files, not a .htaccess file.


0

You can try this one, is working on my websites RewriteRule ^([0-9]+)$ /index.php?id=$1 [L,QSA]



Top 50 recent answers are included