Questions tagged [htaccess]
The htaccess tag has no usage guidance.
68
questions
0
votes
0
answers
43
views
Help needed with .htaccess
I have a website which needs to be changed from Nginx to Apache webserver.
The index directory is nl.html but the HTML extension is removed from the address bar.
If I visit the website example.com it ...
1
vote
2
answers
122
views
Not working `<Location/>` tag in Apache Virtual host
I am trying to create Apache virtualhost that is closed for all IP addresses with exception of one IP address and two URLs that should be publicly accessible.
<IfModule mod_ssl.c>
<...
0
votes
1
answer
327
views
How to generate index.html for each directory under /var/www/html
I have downloaded confluent software for upgrade under /var/www/html directory. I need to create an index.html for directory listing for each directory. I tried adding below to .htaccess file in the ...
-1
votes
2
answers
116
views
allow display and or execution of web files but not direct url access using htaccess
What I want to Achieve is:
I want to be able to display the (mp4 | jpg | ico) file types and execute the (js | css) file types on the browser only on my domain but I dont want them to directly access ...
2
votes
1
answer
884
views
php_value settings in .htaccess
I am in the process of migrating an Apache WordPress site from CentOS7 to AlmaLinux9.
I installed standard LAMP stuff on the AlamLinux9 system, and restored the MySQL and copied over the html ...
0
votes
0
answers
56
views
How to configure Apache for Authentication
i've got a Netgear Readynas 212 and I'm trying to set up a directory isting for a share.
Shares are located in /data/, where /data/share/ is the folder supposed to be listed.
On the NAS initial Share ...
0
votes
0
answers
68
views
prohibit access to pdf files via URL
Simply I am trying to prevent access to all pdf files on my server from being reached and downloaded using URL Eg https://domain.com/test.pdf .
What I succeed to do is : to prevent indexing them, but ...
0
votes
1
answer
275
views
Block access to an URL path by many IPs in .htaccess
I am only able to use .htaccess so <Location> and <Directory> are not possible.
I am currently using this to block access by IP:
<RequireAll>
Require all granted
Require not ip 1....
0
votes
1
answer
37
views
Add lines in every /home/userxxx/public_html/.htaccess file
I have multiple cpanel websites with this file/dir structure:
/home/user0/public_html/.htaccess
/home/user1/public_html/.htaccess
/home/user2/public_html/.htaccess
etc..
And would like to add (not ...
1
vote
1
answer
317
views
.htaccess being ignored by Apache
It seems that the .htaccess file for one of my virtual hosts is being ignored on my production server. The file is identical to working .htaccess files for other vhosts on the same server. Also, the ...
0
votes
0
answers
152
views
Weird behavior on reverse proxy by htaccess
I've set up a reverse proxy on my vps by placing the following .htaccess file under /var/www/html/ecommerce/app.
DirectoryIndex disabled
RewriteEngine On
RewriteRule ^(.*)$ http://127.0.0.1:3000/$1 [...
0
votes
0
answers
796
views
FilesMatch htaccess syntax pain for apache 2.4
someone please tell me why this doesn't work in .htaccess?
#grant access if word-processing format
<FilesMatch "\.([Pp][Dd][Ff]|[Dd][Oo][Cc][Xx]?|[Rr][Tt][Ff]|[Oo][Dd][Tt]|[Tt][Xx][Tt]|[Ww][Pp]...
-1
votes
1
answer
74
views
Problems with .htaccess and slash
I'm trying to solve a problem with .htaccess.
I have this lines in my .htaccess, but the website still have a "with slash" version.
Sorry, it's an erotic page
https://carlamila.es/...
-1
votes
2
answers
96
views
SED for thousand of 301 redirections on htaccess?
I got a headache with URLS after change them on one of my websites.
The URLs were very long and I decided to change them despite the later change via .htacces...
I'm making the change one by one (I ...
0
votes
1
answer
567
views
can't browse to subdomain on apache server, getting forbidden resource permission
I have cPanelA with website A...with subdomain A1 - all is working correctly.
I have created a new cPanelB with website B...and need to move subdomain A1 over to cPanel B as subdomain B1.
Website B is ...
1
vote
0
answers
218
views
Apache2, folder is not visible, without .htaccess is ok
I configured apache2 server on my local and server, same configuration.
Problem is, that on my local there is not visible folder, where is .htaccess file. But on server, with same configuration and ....
0
votes
0
answers
209
views
Using htaccess and htaccess file to configure a folder to be accessible via web only by specific user
I do apologize in advance for my dumb question because I am a beginner in Linux and CentOS.
How can I use an htaccess file and htpasswd file to configure the new folder to be accessible via the web ...
2
votes
1
answer
10k
views
How to Block all Bots using .htaccess? [closed]
I have noticed that Bing bot doesn't follow robots.txt rules
Because i disallowed all bots but Bing bot doesn't follow the rules
I block some bots using .htaccess
is there a code to Block all Bots?
0
votes
1
answer
3k
views
How enable content-length header using .htaccess?
I have a seriously big problem, when i download any file for example: myfile.zip, or when i load a page for example: myserver.com/welcome.html, the response headers not include content-length and the ...
0
votes
1
answer
123
views
htaccess redirect problems
In my var/www/html/ folder there are 2 Angular applications.
One is search and the other one login.
There is no index.html file in /var/www/html/ only 2 folders which contains each a index.html file.
...
0
votes
1
answer
3k
views
How to block empty user agent
I'm using CentOS 7 on my server, and Apache2 as my web server.
In AWStats in my Cpanel, I could see that I've a large bandwidth used by a bot called "empty user agent string" (see the pic attached). ...
1
vote
0
answers
117
views
Redirect http->https, but exclude subdomain
I use Drupal, with a complicated multi-Domain setup, and have a local development site, that uses (locally) the dev. subdomain.
So I want a .htaccess file that can be used on production AND ...
0
votes
2
answers
529
views
Add lines in every /public_html/.htaccess file
Is there a way to perform an .htaccess edit in bulk through ssh?
I have multiple websites which goes like this:
/home/user/website1/public_html/.htaccess
/home/user/website2/public_html/.htaccess
.....
2
votes
0
answers
4k
views
Limitations of using "require user" multiple times in .htaccess in an Apache config? [closed]
Access to a Apache website can be controlled with a line as
Require user john paul george ringo
in a .htaccess file. See https://httpd.apache.org/docs/2.4/mod/mod_authz_user.html.
This same rule ...
1
vote
0
answers
897
views
How to execute a cgi pointed to by a symlink?
My website has several cgi's (executable binaries compiled from C source, in case that matters) that work fine when run from a browser as, e.g.,
http://mydomain.com/cgi-bin/...
1
vote
2
answers
1k
views
.htaccess file ignored by apache
I am working on a web application built using php in codeigniter. Everything works fine in localhost. However .htaccess file is being ignored by my live server (RH7.1 Apache 2.4) despite Overide All ...
4
votes
3
answers
24k
views
How to zip all files including hidden files to zip file using linux command? [closed]
I have linux hosting and wanted to zip everything in one single zip file but all time .htaccess file is excluded and other hidden files are not adding to zip file.
0
votes
1
answer
4k
views
How to allow pdf files in .htaccess?
I have this following codes in my htaccess file, but it doesn't allow pdf file to open, it will redirect to 404 page. how can I allow pdf files to open based on my following htaccess file.
...
0
votes
1
answer
327
views
Setting Options -Indexes recursive [closed]
Is it possible to turn off all indexes for all folders without having to upload the options to every folder?
This is a shared hosting unix server, so server config is not available.
Solved
Even ...
1
vote
1
answer
7k
views
Restrict access to subdirectory in Apache
I've a very easy question. However I have been digging all the manuals for an answer for a full day already.
What I want is to configure Apache to give anyone read access to /var/www but restrict /...
0
votes
1
answer
419
views
Use HTACCESS File to limit access to IP only half working
I am trying to use my HTACCESS file to block all IP's but the ones I want to whitelist.
Below is my HTACCESS FILE:
<LIMIT GET>
order deny,allow
deny from all
# whitelist Boston IP
allow from ...
0
votes
1
answer
729
views
Conditional .htaccess Redirection
There are many questions and answers on this topic. But I'm still stuck!
I've my basic .htaccess in my site that's working great and redirecting everyone my new site's home page.
Options +...
1
vote
1
answer
27
views
More succinct way to block a list of folders in .htaccess
I inherited a php website where the website root is in the top of the project. There is a list of files I don't want accessible from the web server. I setup my htaccess like so:
<LocationMatch "\/\...
1
vote
0
answers
80
views
htaccess Rewrite Rules issu
I am struggling with my RewriteRules. I want to handle requests as follows:
Requests that match example.com/15 (domain/any number), should be handled by my cdn. So I wrote this, but it does not work:
...
2
votes
1
answer
5k
views
Redirect Main domain and subdomain from http to https
i want to redirect these sub domains and main domain from http to https and sub blogs too.
Home directories
WWW (Wordpress): /home1/placehq5/public_html/.htaccess
My Somadome (PHP): /home1/...
0
votes
1
answer
118
views
Limiting Scope of File Writing by PHP Script
I am in the process of writing a PHP script that will add IP address blocks to the .htaccess file. My concern is that I do not want to have the .htaccess file open to the web server user for general ...
1
vote
1
answer
589
views
Subdomain returns forbidden, 403 errors - has to do with .htaccess
I work on a domain and any number of subdomains, which are hosted externally. Inside the directory for the subdomain, there is a .htaccess file, as there are in every subdomain directory. When ...
0
votes
1
answer
598
views
how to force redirect from http to https with htaccess?
I need to force, with htaccess, redirect from http to https of a website.
Required when use shared hosting like dreamhost.
3
votes
1
answer
3k
views
How to test '.htaccess' from command line
I'm trying to track down the cause of an intermittent Apache Internal Server Error during MediaWiki edits and uploads. Some sources tell me to check .htaccess for errors.
I can audit for .htaccess ...
1
vote
1
answer
232
views
DirectoryIndex not redirecting
I am fairly new to apache and was a SQL Server database admin in a former life so please forgive my ignorance. I am trying to set up an Apache web server (HP-UX flavor) to conform with the DOD STIGs ...
2
votes
1
answer
4k
views
Fail2Ban monitor HTPasswd/HTAccess
So i tried putting this in jail.local and restarting fail2ban but no go.
[apache]
enabled = true
port = https
filter = apache-auth
logpath = /var/log/apache*/*error.log
maxretry = 5
[apache]
...
1
vote
1
answer
2k
views
How to use Fail2Ban to protect ProxyPass(ed) applications
So I recently configured an application that uses WebSockets and I am using Apache proxy pass to pass on the application via domain.com/application
The problem is the application is very bare metal. ...
1
vote
2
answers
2k
views
why isn't .htaccess redirecting requests on CentOS 7?
A web app running on CentOS 7 with Apache 2.4 recently changed its domain name from olddomain.com to newdomain.com. The structure of the app at the newdomain.com is different than on the olddomain....
0
votes
1
answer
51
views
How do I override a FILES rule?
There is a directive that denies access to all index.html (file name used for example only).
<files index.html>
errordocument 403 http://mydomains.com/no-access.html
order deny,allow
deny from ...
0
votes
1
answer
486
views
HTAccess: Redirect a subdomain to a another protocoll
I would like to make a rule for a subdomain, so my teamspeak subdomain will directly be redirected to the ts3 protocol.
So, let me show you an example:
RewriteCond %{HTTP_HOST} ^(ts\.)?example\.com$ ...
4
votes
3
answers
27k
views
Deny access to subfolder and file with .htaccess
I need to deny access to configuration files under some subfolder. Currently I have this rule but it doesn't work:
<Files ~ "((foo|bar))$">
Order deny,allow
Deny from all
</Files>
If ...
1
vote
1
answer
3k
views
How to deny access for virtual directories in .htaccess for all IP, and accep for 1 IP?
When you need to deny access to folder for all IP you should to put .htaccess in this folder, which must contein:
Order Deny,Allow
Deny from all
Allow from 1.1.1.1
You can do it in virtual hosts ...
0
votes
2
answers
269
views
How to Replace IP field in Rewrite Condition
.htaccess file contains below excerpt to block specific files and folders.
RewriteCond %{REQUEST_URI} wp-login.php|wp-admin
RewriteCond %{REMOTE_ADDR} !^123.456.789.
RewriteRule . - [R=404,L]
I need ...
1
vote
1
answer
280
views
Htaccess - Map dynamic URL query to a static file
I'm trying to map this dynamic query:
/wp-admin/admin-ajax.php?action=mymail_form_css
to this static file:
/wp-admin/mymail_form.css
What I've tried so far which doesn't seem to work is this ...
0
votes
1
answer
913
views
stop IP address to land on website home page [closed]
I notices that when i type my VPS IP address in address bar then it display website home page. So it may case duplicate content.
Can you please tell me How to stop IP address landing on website home ...