Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [.htaccess]

Directory-level configuration file found mostly on Apache web servers

0
votes
0answers
12 views

Conflicts between htaccess rules [duplicate]

I'm trying to use the url_rewrite system for php but, as i'm a rookie i have a conflict problem (i suppose) between rules. I have these three htaccess rules. The first two are working, the last one ...
-1
votes
0answers
40 views

Redirect `www.example.com/monitor` to `x.x.x.x/monitor` with masking? [on hold]

I finally got folder.example.com to redirect to x.x.x.x/folder, but now the user wants www.example.com/folder to redirect to x.x.x.x/folder. Can you help me? I have tried to do it using .htaccess ...
1
vote
1answer
30 views

Htaccess - -remove parameters from url

I need remove a single parameter from url with htaccess from http://example.com/page/detail/page.php?name=franco&age=50 to http://example.com/page/detail/page.php?age=50 I am using this ...
1
vote
0answers
18 views

Multiple dbd on same apache2 configuration

How can I configure apache2 to read multiple database and have multiple dbd maps on the same domain? Example. I want this two htaccess lines to be both working: RewriteRule ^(.*)$ ${firstmap:$1} [nc,...
1
vote
1answer
23 views

Changed Domain name, now have 2 how to redirect to preferred one using htaccess?

I have a WordPress Site and a PHPBB forum on /forums sub-directory. I added a new domain to the website in Apache. After adding the domain everything would load on both domains. Then I changed the ...
4
votes
2answers
428 views

Apache 2.4 authenticate anonymous users but allow others by IP

I am trying to configure Apache to allow users from a selection of IPs access to a Flask application without authentication, but to challenge any other users for credentials. As things stand I have ...
1
vote
0answers
21 views

Apache2.4 Require IP not working because 127.0.0.1

I am trying to configure .htaccess on Apache 2.4 using Require ip X.X.X.X The problem I am experiencing is that all requests appear to be coming from 127.0.0.1 and not the public IP of the request. I ...
0
votes
1answer
17 views

.htaccess throw 404 and then 301 on nonexistent path

Currently I have this set up in my .httaccess RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !\.(php|html|txt|js|css|png|jpe?g|gif|svg|woff|ico|csv|xml|pdf|gzip) RewriteCond %{...
0
votes
0answers
17 views

should I rewrite my htacces when migrating to php-fpm?

I'm trying to migrate an application written in PHP and running over Apache 2.0 with mpm_prefork and mod_php to Apache 2.4 with mpm_event and php-fpm via mod_proxy_fcgi. It is an application that ...
0
votes
1answer
35 views

How can I access an environment variable set by a rewrite rule in an expression?

I am working on a Symfony 3.4 application which has public and private parts. However, I am currently setting up a staging system for this application which should only be accessed by authorized users,...
0
votes
0answers
32 views

stop ssl redirect going to home page

A site we are working on siterequires forcing to https and www removal When we make that happen using this .htaccess code RewriteCond %{HTTP_HOST} ^www\. RewriteRule ^(.*)$ https://safe.org.nz%{...
-2
votes
1answer
64 views

Multiple websites on same server

When running multiple websites on same server: root/website1 root/website2 root/website3 What should be done to make these websites run intependently - I mean to completely restrict access of PHP (...
0
votes
0answers
85 views

How to prevent 416 and 206 when creating mp4 files on the fly

I have a site that uses multiple servers - main, database, images, ffmpeg/video files. The main server uses wordpress that has a front end form which users use to create posts. They can choose a ...
0
votes
0answers
13 views

How to Redirect https://domain to https://www.domain via .htaccess [duplicate]

I have done a website in codeigniter framework. https://www.aloma.in/ . Now website start listing in google. When clicks on links froom google search results. The site can't be reached. Because URl in ...
0
votes
1answer
50 views

Website stopped working - bad flag delimiters error

I've had a website that has worked for a year. I changed the domain name, and the hosting company copied all of the data to the new hosting account. The website worked for a few days. Now, with no ...
1
vote
1answer
33 views

how to show wildcard subdomain content based on url by .htaccess file?

If the user enters example.domain.com, I want him to see what's in www.domain.com/example. Another example: User will request example.domain.com/photos/gallery.php?from=var1&no=3, he'll see ...
1
vote
1answer
82 views

Are .htaccess redirects secure/reliable (website maintenance)?

Our website will be going down for around an hour or so for maintenance. All users need to be redirected to a page indicating that the website is receiving an update and/or under maintenance. Will ...
0
votes
0answers
19 views

Require all denied, with require ip is blocking all connections

I am facing a weird situation where i couldn't find a proper answer to. I am using some kind of an API where i can send responses to certain requests from the same root domain. My api is in a ...
0
votes
2answers
14 views

Using deny from all inside htaccess in a subdomain restrict access to itself

I am facing a strange situation where i couldn't find a proper answer to. I am using some kind of an API where i can send responses to certain requests from the same root domain. My api is in a ...
0
votes
0answers
29 views

Apache URL redirect using RewriteMap [duplicate]

I am struggling with the last part, writing proper RewriteRule (maybe I also need RewriteCond?). I have this mapping.txt: apple 30/products/apple.png xerox 38/products/xerox-300.png dell 3021/...
1
vote
2answers
38 views

Where is the redirection configured?

I have a redirection but I don't know where it is activated? I have installed a PHP application called GARRADIN. There is an .htaccess containing this line: RewriteRule admin/plugin/(.*?)/(.*) /...
0
votes
0answers
13 views

401 error site loads even if I successfully authorize

I am using the following .htaccess which has multiple functions. 1. show authentification box before a user can enter my website 2. add www to URL if URL starts without 3. Always redirect to `index....
2
votes
1answer
111 views

Deny direct access to files but allow from index.html

I have a simple SPA with followed structure: .htaccess index.html router.php temp ┑ ├─ error.tmp ├─ form.tmp └─ post.tmp js ──┑ └─ m.js How to deny direct access to templates but ...
1
vote
1answer
15 views

URL Redirect for very specific URL

I'm looking to create a .htaccess URL redirect for a specific URL. Redirect /photography/index.php https://www.example.com/photography-services/ but the issue is, I need URL patterns like: https://...
1
vote
1answer
85 views

Website not working if www is in URL [duplicate]

I am forcing my webserver to rewrite a none www URL to www, e.g. https://example.com to https://www.example.com, via .htaccess. RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} !^www\. [NC] ...
1
vote
0answers
45 views

Can .htaccess file read “variable” from external file?

I use a separate file software_version that is included using SSI into html files. So visitors can view current software version on download and some other pages. Also there is an URL to download the ...
0
votes
1answer
14 views

.htaccess issue My domain is in subfolder and how do i redirect http to https

I recently shifted to https:// with SSL for Multi Domain I have a domain in subfolder say domain.com when I try to access example.com it goes fine to https://www.example.com However If I type ...
0
votes
2answers
96 views

.htaccess password protect a file in a certain directory

I have files with the same name in different directories on the serves (example: stats.php), and I want to password protect some of them (.htaccess file in the root directory). I tried "FilesMatch" ...
3
votes
1answer
217 views

replace domain name in htaccess rule with dynamic hostname

I Have this rule in .htaccess: 1 ## Protect from spam bots ## 2 RewriteEngine On 3 RewriteCond %{REQUEST_METHOD} POST 4 RewriteCond %{REQUEST_URI} .wp-comments-post\.php* 5 RewriteCond %{HTTP_REFERER}...
0
votes
1answer
24 views

Simply 301 Redirect /path/ to newdomain.com/newpath/

I have a problem on a WordPress website. I want to redirect come URLs to a new domain. I tried with: # BEGIN 301 Redirects Redirect 301 /old-post/ http://www.newdomain.com/new-post/ # END 301 ...
0
votes
1answer
57 views

Point a subdomain directly to a file

I have a jar file that I would like to make easily accessible to users with a simple subdomain. Currently, they visit https://subdomain.example.com/application.jar and that directly starts the ...
2
votes
1answer
54 views

htaccess change document root to /public and prevent /public from being used

I'm hosting a node app and my folder structure is like this: mydomain.com --index.js --package.json --public\test.txt I want to treat public as my document root and not allow anything above it to be ...
0
votes
0answers
26 views

.htaccess - Can I Conditionally Execute A Block Depending on Server Config?

Is there any possibility to determine server/virtualhost settings in Apache 2.4 from within .htaccess? Similar to the test if some module is loaded: <IfModule mod_rewrite.c> ... </...
0
votes
0answers
30 views

allow ftp to access .htaccess files

First I am a linux newbie. This maybe a very simple thing, but for the life of me I can't seem to figure it out. I inherited a server (ubuntu GUI) running a single website + forum. It is currently ...
2
votes
1answer
49 views

IP blocking with .htaccess in Apache 2.4 - Not Working

I want to block specific IP addresses but allow all others. I'm still struggling with this. First I modified the apache2.conf file to look like this: <Directory /var/www/> Options Indexes ...
1
vote
2answers
878 views

Having specific htaccess credentials for one URL different from rest of site

I'm trying to setup a site so that I a username and password is needed to access the site in general, but for a specific location a different username and password is needed, with the more general ...
1
vote
0answers
36 views

Trying to update PHP servers to PHP7-cgi (7.2)

I'm Trying to update PHP servers to php7-cgi (7.2) in my .htaccess file. Just not sure how exactly to edit the code, haven't been able to get it to work. Here is the code in the .htaccess file: ...
1
vote
1answer
50 views

How can I reset the max-age cache control of my page being redirected ( 302 )

A few hours ago I used the following code in my htaccess to redirect the homepage to a maintenance page: Maintenance redirection RewriteCond %{REQUEST_URI} !/maintenance/index.html$ [NC] RewriteCond ...
0
votes
1answer
17 views

.htacces priority between directives

On a Wordpress installation I want to immediately return a 404 (without a courtesy page) for missing static resources, but the directives seems to conflict. Can you help me to understand solve the ...
1
vote
0answers
23 views

404 on script URL after switching server from Apache to NGINX

I have a woocommerce site that runs a script for accounts that has stopped working after moving from Apache to Nginx. example.com/zynk/index.php/wp_posts?select=ID,meta_value&where=post_type.... ...
1
vote
1answer
56 views

Mod_rewrite is adding /var/www to the resulting url

I have some problems with the Apache mod_rewrite rules. Whenever I try to go to https://example.com// (see double slashes at the end) it redirects to a 301 page but it's adding the location of the ...
2
votes
1answer
124 views

Apache .htaccess RewriteRule and ErrorDocument

I have a .htaccess file : RewriteEngine On DirectorySlash Off RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.mp4|\.ttf|\.eot|\.woff)$ RewriteRule ^(.*)$ ?page=$1 [NC,L,QSA] ErrorDocument ...
-1
votes
0answers
6 views

htaccess mod rewrite little issue [duplicate]

Helo, i'm trying to get some good results but no luck :( By mod rewrite i want to rewrite url from this: https://mysite.pl/praca/template.php?id=25&ogloszenie=pracownikow-gospodarczych-z-...
3
votes
1answer
81 views

Two similar sites, once Apache instance, url rewrite works on one but not the other

My rewrite rules are designed to hide my directory structure and to make URLs easier to read. The gcems site works as expected while the vigotwpfd site will not load the files beyond the first page as ...
1
vote
1answer
27 views

Nginx reverse proxy makes apache2 shut down

I have an nginx server running that reverse-proxies an apache2 server. When I access pages through localhost:8001 - so directly through the apache2 server - every page loads fine. While when I load ...
0
votes
0answers
52 views

url masking via htaccess rewrite is not working

So I am using the below on the .htaccess file: RewriteEngine On RewriteRule ^sale?$ /discount-page/ So that when people visit mysite.com/sale page, they see content from mysite.com/discount-page/ ...
1
vote
2answers
102 views

Denying access to all files except index.php but allow access through “/” in htaccess file

When I try limiting file access to just index.php using something similar to the answer in the link below I am unable to access through the directory index such as "DIRECTORY/" and "DIRECTORY". I ...
-4
votes
2answers
76 views

How do I prevent access on the web to a txt file on my server? i want it to still work, as its for a wizard. But i dont want people to access my code

I'm wondering if anyone can help me please. I have some text files on my server, which run with a Wizard. The issue I am having is that I'm unable to hide the text files on the web browser. I've ...
-1
votes
1answer
31 views

.htaccess file is not getting loaded on Apache 2.4

I am using openSUSE Linux. I failed to create a virtual host so I put my project to the document root at /srv/www/htdocs. The .htaccess File is not getting loaded. My website does still load without ...
3
votes
1answer
126 views

Block access to all php files in subdirectory

I need to block access to all .php files in a subdirectory of my web root. I know that I could create a .htaccess in this subdirectory and use the following: <FilesMatch "\.(?i:php)$"> <...