.htaccess not working (mod_rewrite)
In my case, I changed in httpd.conf: AllowOverride None to AllowOverride All and it works.
In my case, I changed in httpd.conf: AllowOverride None to AllowOverride All and it works.
(I tried $1%20$2 at the end, which also went badly). This looks like a bug. Encoding the space as %20 in the query string should be valid. You can also encode the space as + in the query string (as in your workaround). In your original rule, Apache should be encoding the space (as %20) … Read more
The normal operation of apache/mod_rewrite doesn’t work like this, as it seems to turn the plus signs into spaces. I don’t think that’s quite what’s happening. Apache is decoding the %2Bs to +s in the path part since + is a valid character there. It does this before letting mod_rewrite look at the request. So … Read more
\xef\xbb\xbf are three invisible junk characters (at least from Apache’s perspective) called the Unicode BOM, or byte order mark. Apache thinks that those characters are part of the command that follows right after. This is what you see in the log, though the characters are escaped so they’re visible to the naked eye. \xef\xbb\xbfRewriteEngine In … Read more
It is possible to get it done via mod_rewrite but make sure mod_proxy is enabled in your Apache’s httpd.conf. Once that is done enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.be$ [NC] RewriteRule ^ http://www.mydomain.nl%{REQUEST_URI} [L,NE,P] … Read more
You should have a look at the URL Rewriting Guide from the apache documentation. The following is untested, but it should to the trick: RewriteCond %{HTTP_HOST} ^([^.]+)\.blah\.domain\.com$ RewriteRule ^/(.*)$ http://blah.domain.com/%1/$1 [L,R] This only works if the subdomain contains no dots. Otherwise, you’d have to alter the Regexp in RewriteCond to match any character which should … Read more
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^.*$ /default.php [L]
The following solution works for both proxied and unproxied servers. So if you are using CloudFlare, AWS Elastic Load Balancing, Heroku, OpenShift or any other Cloud/PaaS solution and you are experiencing redirect loops with normal HTTPS redirects, give it a try. RewriteEngine On # If we receive a forwarded http request from a proxy… RewriteCond … Read more
The trick provided by Jon is a nice hack, but I am afraid it could break if you want to use more [OR] conditions, and if you use more backreferences you have to be careful which number to use (%1 or %2 or ..). I think the most elegant, robust and clean solution for smart … Read more
Do this: RewriteCond %{THE_REQUEST} ^.*/index\.php RewriteRule ^(.*)index.php$ /$1 [R=301,L]