Allow downloading of INI files in .htaccess [closed] - .htaccess

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
My website on Debian 9 doesn't allow to download any .ini files located in any folders. How to allow downloading of .ini files at least from a specific folder using .htaccess?

You should ideally find where and how these files are being blocked as it may require additional steps to "unblock". However, you can try something like the following in the .htaccess file in the directory that you want to permit access to all .ini files:
<Files "*.ini">
Require all granted
</Files>
Update from OP:
In error.log I see the following:
ModSecurity: Access denied with code 403 (phase 2). Matched phrase ".ini/" at TX:extension.
I can solve this problem by adding a new directive for Apache:
<IfModule mod_security2.c>
SecRuleRemoveByTag CWAF
</IfModule>

Related

Linux: Redirect ipaddress to domain name [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Is it possible to redirect local ipaddress to domain/subdomain name in linux?
I know it is possible with DNSMasq but my modem doesn't support that.
For testing locally, edit your /etc/hosts file to route subdomain.domain.com to localhost:
127.0.0.1 subdomain.domain.com
DNS will resolve requests to subdomain.domain.com to your local server.
Going the opposite direction, you can setup a reverse proxy to route localhost to a staging or production environment such as subdomain.domain.com. Edit httpd.conf or apache2.conf to include a ProxyPass.
For Apache, this requires mod_proxy module, loading modules proxy_module and proxy_http_module.
Of course, if you are not targeting specific environments, you could simply use relative paths.

Virtual Folders [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm trying to utilise mod_rewrite allowing me to use domain.com/d4k1d to give the same effect as domain.com/link.php?link=d4k1d
At the moment I have this in my .htaccess although this seems to give me 404 errors.
RewriteEngine on
RewriteRule /(abcdefghijklmnopqrstuvwxyz[0-9]+)/ link.php?link=$1
I'm not too familiar with mod_rewrite etc. so I don't know where to go with this :S.
You need to include all of the letters inside of the character class (which can also be simplified). Your current rule only allows for a letter followed by one or more numbers:
RewriteEngine on
RewriteRule /([a-z0-9]+)/ link.php?link=$1
You need to remove the leading slash because it's stripped from the URI by apache before being used in rules that are in an htaccess file.
RewriteEngine on
RewriteRule ^([a-z0-9]+)/?$ /link.php?link=$1 [L]

force php file to subdomain [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a file called video.php on my domain but want it on my subdomain.
now its like www.domain.com/video.php?id=parameter&fewotherparamer=1233
and I want to change it to
video.domain.com/video.php?id=parameter&fewotherparamer=1233
how would this be possible? I already tried to find out using google and the searchfunction here, but didn't find the point.
Thanks
add these directives to .htaccess file in domain.com root directory (or virtual host config) and make sure you enabled mod_rewrite module
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?domain.com$ [NC]
RewriteRule ^video.php$ http://video.domain.com/video.php [R=301,NC,L ]

How to remove directory from URL [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I would like to remove directory from URL. I have a page in mydomain.com/dir/ and all links works under mydomain.com/dir/link1.html, mydomain.com/dir/link2.html etc.
I would like to create single URL which will be mydomain.com/new_link and will trace to mydomain.com/dir/index.php?page=13. I would like it to do only once, for one link, not a regular expression. .htaccess file is located in dir directory with the following content:
RewriteRule ^new_link$ index.php?page=13 [L]
But this causes that the dir is still visible.
I do not entirely understand your question. From what I have understood,
if you want to remove dir from your URL, have your .htaccess in parent directory of dir. I think its the DocumentRoot in your case.
And add this RewriteRule:
RewriteRule ^new_link$ dir/index.php?page=13 [QSA,L]

access denied on localhost .htacces [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
i have a private section where specific users can login on my system (restricted to 4 users)
i want to add IP restriction in the .htaccess using:
<Limit GET POST PUT>
order allow,deny
allow from 127.0.0.1
allow from 192.168
allow from 67.xx.xx
# etc..
deny from all
</Limit>
but i get this error:
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
when i try to access this site locally (i have lamp on my desktop installed, my host file is setup correctly and my apache config is good too)
if I go to my site locally i can see my site with mod-rewrite and errordocument. everything is working fine
why do i get an access denied when i put the restrictin?
you can first deny and then allow:
order deny,allow
deny from all
allow from 127.0.0.1
allow from 192.168
allow from 67.xx.xx
# etc..
obviously I can not test with your setup, but that's what I do.

Resources