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]

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

0
votes
1answer
15 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. ...
0
votes
0answers
18 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
1answer
39 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
0answers
15 views

Sending login credentials for .htaccess

Implementing an .htaccess login is easy, but how do you have users securely send their preferred credentials to you? Right now I have the user email me the output from this tool, but it only prevents ...
0
votes
0answers
21 views

How to allow Options +Index in a .htaccess?

Is it possible to allow Options +Indexes in a .htaccess only for a valid-user ? I would like to mix in a same command: Require valid-user Options +Indexes
0
votes
1answer
41 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
1answer
33 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
0answers
54 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
0answers
97 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
2answers
1k 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
1answer
103 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
0answers
13 views

.htaccess SSL enabled in :root vs /web dir

My website has SSL connection enabled in .htaccess in /web dir but I'm still not sure, if declaring SSL type connection directly in :root .htaccess would help my site be more secure. Of course my main ...
0
votes
1answer
19 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
1answer
27 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
1answer
31 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 ...
1
vote
0answers
654 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
1answer
72 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
0answers
182 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
2answers
4k 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
1answer
2k 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
0answers
52 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 ...
0
votes
1answer
9 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 ...
4
votes
0answers
2k 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....
0
votes
1answer
253 views

Redirecting visitor with htaccess to another URL based on IP range

I've pored through other questions to find a solution, and the closest I've come is Zerobinary99's question here: How do regular expressions work in htaccess to redirect an IP range However, I'm not ...
1
vote
1answer
145 views

How to block the htaccess login dialog box in pop-up ads?

Nowadays some websites won't let you use their platform without disabling your adblocker. I was recently exposed to a new type of pop-up ad : In order to avoid being closed quickly by the user, a ...
0
votes
0answers
141 views

always 404 error on website because of .htaccess file

I hope someone can help me. I have the issue that my .htaccess files does not work. Because if I upload the htaccess file, then my websites (2 domains = 1 server) are down / offline and I can only ...
1
vote
0answers
462 views

How to define parameters/constants in Apache .htaccess files

I don’t have access to the Apache server configuration files and can only influence the configuration through .htaccess files. Unfortunately, this rather limits some things one might want to do. For ...
0
votes
2answers
492 views

How to force www on nginx and symfony

I need to always replace domain.com with www.domain.com and to force https so the final result should always be https://www.domain.com when domain.com or www.domain.com are requested i tried the ...
1
vote
0answers
127 views

Cannot load mod_rewrite Apache module

I am trying to use mod_rewrite module of Apache24 server, but I am not being able to load it. I know there have been many questions asked regarding this topic and I have gone through all of them but ...
1
vote
1answer
151 views

Forward subdomain1.example.com to subomain2.example2.com using .htaccess

My Goal My main website is being hosted by a 3rd party server (Netfirms to be precise). I want most of my content hosted there. However, I am running an employee portal on a local server. The portal ...
3
votes
1answer
2k views

How to show the whole file name while using .htaccess to list files in a directory?

My .htaccess file looks like this : Options +Indexes When I look at the directory from my browser, it looks like this: File names that are too long are truncated, how can I make it show the whole ...
1
vote
0answers
337 views

How to fix AddType or AddHandler problems

I recently moved from an old Godaddy hosting account to a new Godaddy Cpanel hosting account. The menus on the website are generated by using php include statements which worked on the old hosting ...
1
vote
1answer
151 views

Folder password with Apache and Nginx for external connections

I want to secure a folder with username and password. The password should only be needed when accessing the server from outside its network. (192.168.0.0/24) I tried using .htaccess, but it ignores ...
0
votes
1answer
71 views

My .htaccess is not working properly

This is very bizarre. I have never had this issue until now. Basically I have a little code in .htaccess that removes the .php extension from the web pages. For some reason, it has stopped ...
-1
votes
1answer
99 views

How to to prevent Google from indexing

We have setup one of web site on server and site build in php and symfony framework, As my requirement is to prevent Google from indexing and below of my robot.txt and Is prevent using .htaccess? ...
2
votes
2answers
6k views

Restart apache on Docker

I am trying to update my .htaccess file on a Docker container. After updating the file, I need to restart Apache. Whenever I try to restart Apache using the command service apache2 restart, I get the ...
0
votes
1answer
259 views

how to set up a deny rule (e.g. Apache) to block a IP if it connects more than e.g. 5 times per second?

if I want to block any IPs that connects the server more than 5 times per second, how to do that? I am currently using CloudFlare firewall to manually block such IPs but it would be nice to make it ...
1
vote
0answers
310 views

Deploying web.py project to Bluehost, WSGIServer: missing FastCGI error

I'm trying to deploy a very simple web.py app to my Bluehost website using these instructions. Here's my main python file: #!/usr/bin/python import web from web import form import whitelistchecker ...
1
vote
1answer
3k views

How can I compress a jpg images for google insights optimisation

I m getting this error when tring to see the speed of my website in google page speed: Optimize images Properly formatting and compressing images can save many bytes of data. Optimize the following ...
0
votes
1answer
775 views

Allow PHP to execute in a specific subdirectory, when parent directory is denied?

I operate a small shared server and would like to give some of my users the ability to execute PHP code from the browser (but not all of them) but have been unable to do so. In the top level ...
0
votes
1answer
27 views

.htaccess mask on current website

I've got a website on a FTP, mysite, on which I have : /index.php which is my real site /preprod/index.php, which is my pre-production website I want to make the preprod website visible to any ...
1
vote
0answers
190 views

Rewrite without url changing

I would like to redirect (without url changing) from mysite.com/order/business to mysite.com/order/index.php?tariff=business I have this .htaccess: Options +FollowSymLinks RewriteEngine on ...
2
votes
1answer
2k views

Cross-origin directives in httpd.conf?

I am a part time Apache administrator (not by choice). We have an animated gif hit counter. I want to add a CSP to disable active content, but include a CORS policy to allow the gif for the hit ...
0
votes
1answer
2k views

.htaccess RewriteRule to redirect all to root

I would like to redirect every request to root by using RewriteRules in my .htaccess file (later on I will copy them to a vhost file). I tried something like this: RewriteRule ^(.*)$ http://test....
2
votes
0answers
53 views

How to have .htaccess inherit defines from httpd.conf

I defined a path variable in my httpd.conf: Define OOSPATH D:/oos This define can be used anywhere in the httpd.conf or files which are included from there. The same path needs to be used in a ...
1
vote
2answers
476 views

How to block website visitors from accessing image files?

SCENARIO I am hosting a website on an Apache server, where the images are saved on an img folder. I have already solved the issue of users accessing folders they are not intended to, placing some ...
6
votes
2answers
3k views

How can I highlight .htaccess code in Notepad++?

How can I highlight .htaccess code? I downloaded this XML file and I copy and pasted file content to userDefinedLanguage.xml inside my install directory. According to the documentation found here I ...
0
votes
1answer
1k views

Redirect all subdomains, subpages, and the root domain to themselves on another domain

I have done a lot of searching and have tried many things but I have still not managed to find a way of doing this exactly how I want it. Without having to make an Apache VirtualHost for each ...
1
vote
1answer
263 views

Apache is requesting .htaccess from user directory which is parent dir to DocumentRoot

I have my website/blog in /home/tarach/www/tarach.net All files and directories starting from /home/tarach/www are to user: tarach, group: www-data ( apache httpd group ) I've setup virtualhost ...
1
vote
0answers
429 views

Make static site from wordpress site using bash

I have tried a few other scripts that can make a static version of a wordpress site but none of them are designed for bulk sites and I haven't found any that will just serve a static version while ...