Questions tagged [htaccess]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
184 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 ...
adbdkb's user avatar
  • 103
-1 votes
2 answers
107 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 ...
genesis lubrigas's user avatar
0 votes
0 answers
28 views

Set cache-control in .user.ini

I have a new AlmaLinux 9 installation with apache and php installed. I am converting my .htaccess files to .user.ini Although going well, I can't figure out the user.ini equivalent of the following:...
TSG's user avatar
  • 1,698
2 votes
1 answer
369 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 ...
TexasTim's user avatar
0 votes
0 answers
55 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 ...
BlackArch.py's user avatar
0 votes
0 answers
54 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 ...
MertHaddad's user avatar
0 votes
1 answer
246 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....
Jonas Eberle's user avatar
0 votes
1 answer
35 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 ...
Hueznar's user avatar
  • 15
1 vote
1 answer
226 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 ...
dcorsello's user avatar
  • 131
0 votes
0 answers
135 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 [...
Logan Lee's user avatar
  • 249
0 votes
0 answers
712 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]...
RussH's user avatar
  • 1
-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/...
Jordi Webmaster's user avatar
-1 votes
2 answers
94 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 ...
Jordi Webmaster's user avatar
0 votes
1 answer
528 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 ...
rolinger's user avatar
  • 165
1 vote
0 answers
211 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 ....
genderbee's user avatar
  • 121
0 votes
0 answers
196 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 ...
Boka woofer's user avatar
2 votes
1 answer
9k 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?
Patricia Smith's user avatar
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 ...
Arthur Lincohn's user avatar
0 votes
1 answer
122 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. ...
Raijin92's user avatar
0 votes
1 answer
2k 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). ...
azari ezz's user avatar
1 vote
0 answers
113 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 ...
nerdoc's user avatar
  • 151
0 votes
2 answers
510 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 .....
evul's user avatar
  • 13
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 ...
Cie6ohpa's user avatar
  • 243
1 vote
0 answers
836 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/...
John Forkosh's user avatar
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 ...
Awais Tariq's user avatar
4 votes
3 answers
23k 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.
Parth Kundariya's user avatar
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. ...
Jona's user avatar
  • 1
0 votes
1 answer
318 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 ...
Chris Cox's user avatar
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 /...
Richard Brinkman's user avatar
0 votes
1 answer
413 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 ...
Denoteone's user avatar
  • 111
0 votes
1 answer
724 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 +...
Ramnath's user avatar
  • 151
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 "\/\...
Justin Dearing's user avatar
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: ...
HerrMotz's user avatar
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/...
Navdeep.D2's user avatar
0 votes
1 answer
111 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 ...
user avatar
1 vote
1 answer
575 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 ...
naltun's user avatar
  • 185
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.
carlo denaro's user avatar
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 ...
user avatar
1 vote
1 answer
181 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 ...
Michelle Carter's user avatar
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] ...
FreeSoftwareServers's user avatar
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. ...
FreeSoftwareServers's user avatar
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....
CodeMed's user avatar
  • 5,199
0 votes
1 answer
50 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 ...
mmcglynn's user avatar
  • 109
0 votes
1 answer
478 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$ ...
Jannik's user avatar
  • 121
4 votes
3 answers
26k 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 ...
stecog's user avatar
  • 2,271
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 ...
mr_blond97's user avatar
0 votes
2 answers
266 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 ...
NecNecco's user avatar
  • 701
1 vote
1 answer
278 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 ...
SelfTaught's user avatar
0 votes
1 answer
910 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 ...
Rinku Yadav's user avatar
7 votes
3 answers
23k views

Authenticate users via LDAP using nginx

I know how to auth the users via LDAP in apache2: # put the following in the VirtualHost <VirtualHost *:443> ServerAdmin [email protected] DocumentRoot /var/www <Directory /&...
thequestionthequestion's user avatar