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
41 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
19 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. ...
4
votes
2answers
22k views

Using .htaccess with IIS

It is necessary for me to make it possible for .htaccess files to be usable with IIS. Is there a way for this to be done? I know that on its own, IIS is not capable of handling this, but could I ...
0
votes
1answer
48 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
22 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....
0
votes
0answers
56 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
1answer
34 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
2answers
1k views

301 redirect with special characters

Trying to do a redirect like: Redirect 301 /blog/tag/blog/alarmforce%20videorelay http://www.mysite.com/blog/tags/tag/alarmforce-videorelay I guess the space is causing the issue. I've tried ...
1
vote
0answers
110 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 ...
1
vote
0answers
323 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 ...
0
votes
1answer
116 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
32 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
674 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
73 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
1answer
4k views

.htaccess file not running and internal server error

I am using ubuntu 14.04 and have LAMP environment. I have one of the project in dir /var/www/html/project1 . It can't access the .htaccess file for rewriting url rules. For that i have to change in /...
0
votes
0answers
185 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
5k 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 ...
1
vote
1answer
832 views

mod_rewrite path info postfix and per-dir prrefix

There's an issue with .htaccess configuration. I just need the url /category to match the category.php script, but when I try to open this url, there's a 404 error instead. Here's my .htaccess: ...
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
256 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
154 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
2answers
502 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 ...
0
votes
0answers
146 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
471 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 ...
1
vote
0answers
131 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
153 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
347 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
161 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 ...
5
votes
4answers
7k views

How do I block a host by ASN? Example - AS16276

There are a handful of especially toxic hosts out there. There is no reason we need to allow any of their IP's access to our servers. Is there a way we can block them using their ASN or other global ...
0
votes
1answer
76 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 ...
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 ...
-1
votes
1answer
100 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
269 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 ...
7
votes
1answer
35k views

.htaccess 301 redirect with regular expressions

If I have: redirect 301 /users/foo http://www.example.com/profiles/foo redirect 301 /users/bar http://www.example.com/profiles/bar Can I do something like? redirect 301 ^\/users/(.+)$ http://www....
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
2answers
1k views

How to choose php version in .htaccess

I would like to install my PHP web application on a service that has two PHP versions, 4 and 5. I need PHP5, and I don't have access to httpd.conf due to server restrictions. How can I tell the Apache ...
4
votes
1answer
8k views

configuring cgi-bin using .htaccess

I'm trying to configure a directory as cgi-bin using .htaccess, but when I try to access the executables, the files are downloaded. I'm using apache2.2. What is the problem? My .htaccess looks like: ...
0
votes
1answer
783 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 ...
4
votes
0answers
521 views

why Safari always GET status 200, never 304 for my .swf file?

I serve a Flash app as a .swf file (with HTML wrapper file), and Safari always retrieves with GET status = 200, never 304. Thus, Safari never uses cache for this file and downloads it each time (it's ...