Apache: edit to .conf file produces “Invalid command ‘Header'”

In order to use Header directive in apache you have to load mod_header module. You can test if module is loaded or not by :- apache2ctl -M | grep headers_module find / -name mod_headers.so If it is loaded you will see something like :- headers_module (shared) /usr/lib/apache2/modules/mod_headers.so If you see no output of find command … Read more

How can I remove file extension from a website address?

Just add an .htaccess file to the root folder of your site (for example, /home/domains/domain.example/htdocs/) with the following content: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php More about how this works in these pages: mod_rewrite guide (introduction, using it), reference documentation

Add slash to the end of every url (need rewrite rule for nginx)

More likely I think you would want something like this: rewrite ^([^.]*[^/])$ $1/ permanent; The Regular Expression translates to: “rewrite all URIs without any ‘.’ in them that don’t end with a “https://stackoverflow.com/” to the URI + “https://stackoverflow.com/”” Or simply: “If the URI doesn’t have a period and does not end with a slash, add … Read more

urlencoded Forward slash is breaking URL

Apache denies all URLs with %2F in the path part, for security reasons: scripts can’t normally (ie. without rewriting) tell the difference between %2F and / due to the PATH_INFO environment variable being automatically URL-decoded (which is stupid, but a long-standing part of the CGI specification so there’s nothing can be done about it). You … Read more

.htaccess rewrite subdomain to directory

Try putting this in your .htaccess file: RewriteEngine on RewriteCond %{HTTP_HOST} ^sub.domain.example RewriteRule ^(.*)$ /subdomains/sub/$1 [L,NC,QSA] For a more general rule (that works with any subdomain, not just sub) replace the last two lines with this: RewriteEngine on RewriteCond %{HTTP_HOST} ^(.*)\.domain\.example RewriteRule ^(.*)$ subdomains/%1/$1 [L,NC,QSA]