Forum Moderators: phranque
RewriteEngine on
RewriteRule ^/classifieds/[\w-]+?/(\d+)/?$ /classifieds/view/index.php?id=$1 [QSA,L]
# this rule is not verbatim, I changed the client's name to "foo" and "bar"
RewriteRule ^/foo(?:bar)?(?:inc)?/?$ /classifieds/list.php?username=foo@bar.net [QSA,NC,L]
RewriteRule ^/(?:classifieds/)?autos/?$ /classifieds/list.php?cat=autos [QSA,NC,L]
RewriteRule ^/(?:classifieds/)?guns/?$ /classifieds/list.php?cat=guns-hunting [NC,QSA,L]
RewriteRule ^/(?:classifieds/)?pets/?$ /classifieds/list.php?cat=pets-animals [NC,QSA,L]
RewriteRule ^/(?:classifieds/)?dogs/?$ /classifieds/list.php?cat=pets-animals&subcat=dogs [NC,QSA,L]
RewriteRule ^/(?:classifieds/)?yardsales/?$ /classifieds/list.php?cat=yard-sales [NC,QSA,L]
RewriteCond %{REQUEST_URI} !^/classifieds/(?:thumbs|photos|reviews|list|view|includes) [NC]
RewriteRule ^/classifieds/([a-z-]+)(?:/([a-z-]+))?/?$ /classifieds/list.php?cat=$1&subcat=$2 [NC,QSA,NE,L] the problem is with the silent redirect in general.
for each of these now I'm getting "No input file specified".
For testing, I changed each of them to [R=301], and THEN they worked.
http://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_pt The target (or substitution string) in a RewriteRule is assumed to be a file path, by default. The use of the [PT] flag causes it to be treated as a URI instead. That is to say, the use of the [PT] flag causes the result of the RewriteRule to be passed back through URL mapping, so that location-based mappings, such as Alias, Redirect, or ScriptAlias, for example, might have a chance to take effect.
# Using .htaccess
First Byte: 0.511
Start Render: 1.900
First Contentful Paint: 1.831
Speed Index: 2.365
# Using .conf
First Byte: 0.549
Start Render: 1.900
First Contentful Paint: 1.930
Speed Index: 2.750 <Directory />
AllowOverride none
</Directory> # with AllowOverride none
First Byte: 0.238
Start Render: 1.400
First Contentful Paint: 1.328
Speed Index: 1.899 Now THIS had an impact!Yup. The extra time and work for the server isn't so much reading the .htaccess and parsing its RegExes over and over again. It's the act of having to look for the .htaccess, all the way up the line through every directory--and repeat for every module, on every request.
<Directory "/">
AllowOverride none
</Directory>
# use the full path instead of relative?
<Directory "/home/example/www/excluded-directory">
AllowOverride all
</Directory> AllowOverride Directive
When this directive is set to None and AllowOverrideList is set to None, .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.
Default: AllowOverride None (2.3.9 and later), AllowOverride All (2.3.8 and earlier)but I guess it's not as scary a flip-flop as it looks: The default has changed because the Override directive can be overridden (haha) via AllowOverrideList. And the default for AllowOverrideList is also None, implying that if you don't include the line(s) at all, you still get the intended result.
In the example above, only the Redirect and RedirectMatch directives are allowed. All others will cause an internal server error.Urk. I really, really prefer when a directive doesn't bring the whole thing to a crashing halt.