Questions tagged [htaccess]
The hypertext access web server configuration file used for overriding configuration on a per-directory basis.
158
questions
0
votes
0
answers
53
views
Restrict access to specific http_host with .htaccess
I'm wondering if anyone knows how to approach this predicament I am facing using .htaccess.
I have a website that is accessible using 2 different domains. For one of the domains, I only want the ...
1
vote
1
answer
258
views
Changing content type of .js.php files using .htaccess doesn't work
I want to change the Content-Type HTTP header of some file endings to application/javascript so I don't get an error or warning in the browser. I got .mjs and .js.php. files. The latter are PHP ...
1
vote
1
answer
280
views
Htaccess remove trash from end of URL using redirect 301
I need to remove "trash" from the end of the URL.
I have more than 1000 URLs with this word: "card link" at the end of the URL.
The URL before the word "card link" is ...
1
vote
1
answer
191
views
htaccess RewriteRule regular expression for url with any nesting
There is a site example.com/aaaa/bbbb/cccc/.../zzzz, where /aaaa/bbbb/cccc/.../zzzz is a path with any nesting.
If the URL contains a file or directory starting with a dot (hidden file or directory) ...
0
votes
1
answer
213
views
How to mask a URL on a different port with htaccess rewrite
I have a page with a URL like this:
https://example.com:3000/newsite
but I want to be able to access it from here:
https://example.com/newsite
and mask the URL as well so it will always show ...
0
votes
0
answers
163
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\...
0
votes
1
answer
1k
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 ...
1
vote
0
answers
14
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....
0
votes
0
answers
84
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)
...
0
votes
0
answers
332
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
...
0
votes
1
answer
55
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 ...
0
votes
1
answer
56
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 ...
1
vote
1
answer
285
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=...
0
votes
1
answer
1k
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
...
1
vote
0
answers
19
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:
<...
1
vote
0
answers
268
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 ...
0
votes
1
answer
3k
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.
1
vote
2
answers
1k
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 ...
0
votes
1
answer
213
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 %{...
1
vote
1
answer
2k
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
...
2
votes
1
answer
214
views
Query about htaccess and preventing access to a directory
I have developed a website which has a structure that can be summarised as:
htdocs
.htaccess
...
wp-content
...
uploads
...
Private
.htaccess
....
0
votes
0
answers
422
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 ".*\....
0
votes
1
answer
1k
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 ...
0
votes
1
answer
558
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....
0
votes
1
answer
361
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, ...
0
votes
0
answers
57
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 ...
1
vote
0
answers
229
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 ...
0
votes
1
answer
177
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....
0
votes
2
answers
1k
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 ...
0
votes
0
answers
136
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....
1
vote
1
answer
50
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]...
1
vote
1
answer
75
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 ...
0
votes
1
answer
289
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. ...
2
votes
1
answer
4k
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
...
0
votes
1
answer
488
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 ...
0
votes
1
answer
55
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....
1
vote
1
answer
51
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} ...
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 ...
1
vote
0
answers
472
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:...
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 ...
0
votes
1
answer
652
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....
0
votes
1
answer
84
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&...
1
vote
1
answer
264
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 ...
1
vote
1
answer
44
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 ...
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 -&...
0
votes
1
answer
302
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 ...
0
votes
0
answers
247
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 ...
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 ...
0
votes
1
answer
7k
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 ...
0
votes
0
answers
123
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 ...