Questions tagged [htaccess]

The hypertext access web server configuration file used for overriding configuration on a per-directory basis.

Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

Require host for Apache 2.4 not work. Try HostnameLookups Off

I have been trying to set up a site with Apache 2.4 using dynamic host protection. [Thu Apr 21 08:25:00.886928 2022] [authz_core:error] [pid 17590:tid 47572649436928] [client 92.59.240.169:37612] ...
user avatar
0 votes
0 answers
62 views

Convert htaccess rewrite rules script to nginx config

please hlep with this script... i want convert htaccess rewrite rules script to nginx config. .htaccess: AddDefaultCharset utf-8 <IfModule mod_rewrite.c> RewriteEngine on RewriteCond $1 !^(index\...
user avatar
0 votes
0 answers
114 views

Hide specific files in Apache 2 directory listing using .htaccess

Hello! TL;DR: I am trying to hide certain files using the Apache .htaccess file while browsing a directory listing. Link: https://repo.jovarkos.org/iso What I am not looking for: Disable Directory ...
user avatar
0 votes
0 answers
22 views

how to whitelists browsers with htaccess?

I found on this website great htaccess: https://htaccessbook.com/whitelist-good-bots/ # whitelist: good bots # allow major browsers RewriteCond %{HTTP_USER_AGENT} !^.*AOL.* [NC] RewriteCond %{...
user avatar
0 votes
1 answer
162 views

How to enable apache directory listing on DSM6?

I want an index to be automatically generated, very similar to the example below. For my website on the internet my web host configured Apache properly, now I need to do this for our intranet on a ...
user avatar
  • 113
1 vote
0 answers
12 views

How to redirect to a different php document in htaccess file

Currently I have the following htaccess file Options -Indexes DirectoryIndex .base.php RewriteEngine On RewriteRule . .base.php how can I modify this in order to redirect to another php file (image....
user avatar
0 votes
0 answers
35 views

Renaming a download file via htaccess

I currently have in a server files in this format https://example.com/files/{group_no}/{date}/{file_no}-file.txt Being: group_no an integer (NN) date format YYYY-MM-DD file_no an integer (NN) ...
user avatar
0 votes
0 answers
35 views

Remove parameters from URL

I need remove a parameter from urls with htaccess from 1) http://example.com/?id=126:&catid=89 2) http://example.com/page?id=126:&catid=89 to 1) http://example.com/ 2) http://example.com/page ...
user avatar
0 votes
1 answer
24 views

Setting default webpage for shared hosting [closed]

I've got a bunch of domains on a shared ip address (through bluehost, not sure if that matters). Visiting any domain works fine, but visiting the ip address just triggers a 404 error. After doing some ...
user avatar
0 votes
1 answer
40 views

Apache2 Logs - Single user agent shows as an escaped string

first time caller long time listener. I've been playing around with hosting my own web server via Apache on an Ubuntu VM. I've been reviewing the access.log file, and noticed a discrepancy I can't ...
user avatar
1 vote
1 answer
23 views

.htaccess RewriteRule works but Redirect 301 does not

I have launched a new version of a website on a new domain. On the old domain I have redirected traffic to the new domain with a global RewriteRule. RewriteRule (.*)$ https://www.newsite.com/$1 [R=...
user avatar
0 votes
1 answer
258 views

Redirect to a specified port when using https

I have an internal domain: cloud.flint.lo I would like to achieve the following: If URL=http://cloud.filnt.lo Redirect to: https://cloud.flint.lo:5001/sub If URL=https://cloud.flint.lo ...
user avatar
  • 125
1 vote
0 answers
16 views

I'm running Apache 2.4.7, but my .htaccess files are only working with pre-2.4 directives & syntax

I've been dealing with a pretty unusual issue all day. My remote server is running Apache version is 2.4.7 However, when I start setting up directives in the .htaccess files such as this: <...
user avatar
1 vote
0 answers
151 views

phpmyadmin not working after php verion Update

I have VPS with below things installed Nginx, PHP 7.2.22, 10.3.18-MariaDB Recently Updated PHP version from 7.1.17 to 7.2.22 .. After this, website is working fine.. PHPMyAdmin set on custom ...
user avatar
0 votes
1 answer
2k views

Google Cloud-How to access and edit .htaccess on Wordpress Bitnami on google-cloud-platform

If anyone can please guide me on How to edit .htaccess file in WP-Bitnami installation on Google cloud platform.
user avatar
  • 1
1 vote
2 answers
759 views

Apache 2.4 .htaccess Require statements ignored

I'm trying to restrict per-client subdirectories of an application containing static reports using .htaccess files programatically generated with a list of users for each customer, but while I can ...
user avatar
0 votes
1 answer
154 views

htaccess to Nginx rewrite rules

I've converted apache htaccess rules to nginx rewrite rules but they are not working for me. Apache .htaccess rules RewriteEngine On RewriteBase /public/layout/themes/ RewriteCond %{...
user avatar
  • 37
1 vote
1 answer
568 views

htaccess if directive does not work

The following directive appears to fail in that it results in a 403 error. The server supports version 2.4 of Apache. <If "%{REQUEST_URI} =~ m#^(.*)?/uploads/(.*\.txt)#"> Require all denied ...
user avatar
  • 209
1 vote
0 answers
34 views

Query about htaccess

I have developed a website which has a structure that can be summarised as: htdocs .htaccess ... wp-content ... uploads ... Private .htaccess ...
user avatar
  • 19
0 votes
0 answers
210 views

.htaccess not working on some files

My .htaccess file looks like: # Prevent .htaccess files from being viewed <Files ".ht*"> Require all denied </Files> # Deny access to files with extensions <Files ".*\....
user avatar
  • 101
0 votes
1 answer
740 views

Nginx rewrite rules not working

We are moving our site from Apache to Nginx. So far, the rules that we have converted from .htaccess rules to nginx are working fine but this particular rule is giving me a hard time. I've tried ...
user avatar
  • 37
0 votes
1 answer
339 views

Redirect rule for URLs ending with the same suffix?

So I have a number of pages with URLs end in the same thing but have different content between the main URL and the final suffix. Some of these have multiple levels. For example: https://www.example....
user avatar
  • 1
0 votes
1 answer
203 views

How do I use .htaccess with offline html?

I have an offline webpage composed of Html, CSS, and JS, it runs completely offline. One problem, I want to use htaccess to add Username/Passwords to my webpage, along with other features of htaccess, ...
user avatar
0 votes
0 answers
35 views

Automatic site builder failing to create .htaccess files locally

I have a vagrant box with PHP code building a site in it. The user is vagrant with id: uid=900(vagrant) gid=900(vagrant) groups=900(vagrant),27(sudo),1002(admin) The parent directory in question ...
user avatar
1 vote
0 answers
174 views

Nextcloud service discovery not fully working

I have a nextcloud instance on shared hosting. Unfortunately I cannot use it for cal-/carddav because (only) macs cannot seem to find the offered services. Since a few versions, the nextcloud ...
user avatar
  • 135
0 votes
1 answer
54 views

Static html site, additional parameters after page still work. How to display 404?

I have a site that is 100% static html. I noticed that Google was showing that I have several pages that show additional parameters at the end of the URL. Example: https://www.example.com/page1....
user avatar
  • 1
0 votes
2 answers
575 views

Why Is .html File In Root Directory Not Rendering In Browser? Shows Index Of/

Hello I just have a simple .html file in the root directory of my site: But when I visit that site in the browser, it's showing me index of/ and I have to click on test.html in order to display the ...
user avatar
0 votes
0 answers
113 views

.htaccess redirect site X to site Y without loosing URI

I tried to figure out how to redirect 401.shtml to index.php. It works like this: Redirect /401.shtml /index.php But if there is a URI then it should redirect to the URI instead of index.php. e.g....
user avatar
  • 6,432
1 vote
1 answer
48 views

Can't figure out a htaccess rule

I have this in my htaccess but can't figure out what its for. Because of the nature of rule, searching doesn't help either. RewriteCond %{REQUEST_URI} !(/$|\.) RewriteRule (.*) %{REQUEST_URI}/ [R=301]...
user avatar
1 vote
1 answer
68 views

Redirecting another domain to a current domain assigned to a Wordpress website

I have two domains example.com and example.org which are both registered through 1&1. The current Wordpress website uses the .org and the .com domain has been set to be redirected to .org from the ...
user avatar
0 votes
1 answer
165 views

Redirect Non WWW to WWW - htaccess placed in sub-folder

I am working on a site which has .htaccess file in root. There is a folder named babynames. This folder also has .htaccess file. I need the code to redirect from NON WWW to WWW for this folder. ...
user avatar
2 votes
1 answer
3k views

Apache 2.4 'require host not' works but gives repeated AH01753 [authz_host:error] in apache error log

Something is bothering me after my hosting provider went from Apache 2.2 to Apache 2.4. I had these Apache 2.2 rules in my .htaccess order allow,deny deny from domain.tld deny from 1.2.3.4 ...
user avatar
0 votes
1 answer
375 views

How to use Webstorm's local server with a .htaccess file to show pages without .html

I have configured the .htaccess file as per this StackOverflow article. I am now wondering how I get the same functionality for Webstorm as I have setup my links such that they don't have '.html' at ...
user avatar
  • 101
0 votes
1 answer
52 views

Use sub-domain of domain in another server

I have two hosting services. One is already in use and has domain example.com. It also has a sub-domain called order.example.com. Second hosting service is under Amazon (EC2). How can I use order....
user avatar
1 vote
1 answer
48 views

SSL forwarding for just one subdomain in .htaccess

I have Apache(ubuntu) server and I need to force https just for sub1.domain.com. Currently all traffic are being forwarded RewriteEngine On RewriteCond %{HTTPS} ...
user avatar
0 votes
0 answers
125 views

What htaccess rules will REMOVE the subdirectory serving the site from the URI (404 if included) & internal links?

**SEE UPDATE BELOW***** My primary domain site is to be served from a subdirectory on my server that is named same as the domain, so that will probably be confusing to read in this messy block of my ...
user avatar
1 vote
0 answers
330 views

redirect subdirectory requests to alternate server:port

I'm using the following .htaccess to redirect requests to domain root ( http://example.com ) in apache to an alternate webserver on the same host listening on an alternate port ( http://example.com:...
user avatar
  • 111
2 votes
2 answers
4k views

How to use .htaccess to block Russian IP addresses?

I added this code to my .htaccess file #deny all russian IP's Order allow,deny deny from .ru Allow from all My questions: Can it go anywhere in the file? I added it to the end. Do I put the code in ...
user avatar
0 votes
1 answer
519 views

Removing lingering end string after RewriteRule

I've tried everything but just can't seem to get things right :( I have over 800 urls and I need to rewrite them to point to a simple pdf file. Currently, I have links to: http://subdomain.mydomain....
user avatar
0 votes
1 answer
37 views

Redirect links using .htaccess file

I have a site with a lot of links that look like /click.php_id=602_from=139_to=42_url=1.html. I'd like to setup a redirect using .htaccess file(s) to have links that look like /click.php?id=602&...
user avatar
  • 1
1 vote
1 answer
200 views

How to point URL to directory? [closed]

I need to point web url's like http://example.com/subdir1 http://example.com/subdir2 to same directory /var/www/vhosts/example.com/httpdocs/default/ on Linux hosting (Ubuntu 16.04, Apache2) - how ...
user avatar
1 vote
1 answer
41 views

Allow http access only from two selected IPs and get alerts for other attempted logins

we want a system where our server can be accessed only by 2 selected systems. Also we need to log any other attempted access. One possible option we have is: order deny,allow deny from all allow ...
user avatar
  • 97
3 votes
0 answers
1k views

Redirect multiple domains and subdomain with .htaccess

I am struggling with setting proper https redirect via a .htaccess file for my domains. I have the following domains, subdomains and directories: public_html/ -> www.red.com public_html/drk -&...
user avatar
0 votes
1 answer
241 views

Browser displays Apache Test page when accessing website with a domain name I have just registered

My website is deployed on Tomcat which in turn in deployed on Ubuntu server. While developing the website I access it using server IP address like xxx.xxx.xxx.xxx:8080:/yyyy. Now I have bought a ...
user avatar
0 votes
0 answers
237 views

Possible .HTACCESS Issue

I am running a youtube clone script on a local install of XAMPP via a windows 7 machine. After installation I am able to see the home page but if I navigate to any other page either by link or direct ...
user avatar
  • 135
1 vote
2 answers
9k views

Forcing HTTPS with .htaccess on site with Wordpress in subfolder

I can't get my .htaccess file to work to force HTTPS traffic Site structure that I see if I ftp to my hosting provider: / domains mydomainname.com public_html blog The files for ...
user avatar
  • 3,918
0 votes
1 answer
6k views

Howto change the port in an URL using .htaccess

Using .htaccess, I need to change any URL of this kind https://example.com:80/webtrees/anything_else by exactly the same, but with 443 instead of 80 Note that I already have this in my .htaccess (it ...
user avatar
0 votes
0 answers
118 views

How to redirect url in htaccess with regex?

My url is changing and for example now it is ..safety-bathroom then is changing to safety-bathroom-1 and so on, to avoid daily changing rule in htaccess I would like to have a rule which will do ...
user avatar
  • 111
0 votes
1 answer
12 views

utilize htaccess to rewrite all indexes

upon a 404 I want to set my htaccess file to utilize another file from another location in lieu of the missing file. The url must remain the same as if the file was in the directory & more ...
user avatar
5 votes
2 answers
4k views

Redirect all HTTP traffic to HTTPS including subdomains

I'm trying to redirect all HTTP traffic to HTTPS including subdomains. I have the domain setup with FastComet on their Shared Hosting using cPanel. Some examples of how I like to redirect. http://www....
user avatar
  • 239