Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

3
votes
4answers
6k views

How to redirect non-www to www without hardcoding using .htaccess?

RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] ...causes a perfect, non-hardcoding 301 redirect from "www to non-www", ...
0
votes
1answer
26 views

How to use parts of the old URL in a 301 redirect [duplicate]

is it possible to keep certain parts of an URL and to rewrite the rest? With a .htaccess 301 redirect. In my example I would like to rewrite URLs from this format http://blog.example.com/post-name ...
0
votes
1answer
86 views

how to sort apache directory listing in last modified order

# SET DISPLAY ORDER IndexOrderDefault Descending Name the above value is used to sort directory listing in decending name value how can i create the similiar results for sorting the directory in ...
1
vote
1answer
355 views

in an SSI include, can the file being included be redirected in an .htaccess file

I have some old html pages that have SSI includes in them to include certain html in all the pages. So, the SSI looks something like this: <!--#include ...
0
votes
2answers
33 views

Apache Alias to link to another DocumentRoot

I have a WordPress installed in /var/www/wordpress/ and my own code in /var/www/project/ Now comes the following problem: When I try to access example.com/client/ or example.com/admin/ it should link ...
0
votes
0answers
2k views

cant remove index.php from url in codeigniter

iam new in codeigniter frame work,i want to remove index.php from url and tried many times bt its not working..... here is my .htaccess file RewriteEngine on RewriteBase /test/ RewriteCond $1 ...
0
votes
1answer
17 views

Apache redirect and pass query string on to remote host

I'm hoping this is super easy for someone. I need to create a redirect in apache where... http://something.com/a/1234567890 -> http://other.com/a/1234567890 http://something.com/a/8971347873 -> ...
15
votes
3answers
29k views

How to enable either Gzip or Deflate compression via .htaccess?

How to enable either Gzip or Deflate compression via .htaccess and which one is best these days? Code examples needed.
0
votes
0answers
28 views

htaccess with accents breaks url with ñ character

I have the following htaccess with the url: http://localhost/caña working fine. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} -f RewriteRule .? - ...
0
votes
0answers
14 views

Redirecting permalinks and loading the same content

We're currently serving articles for a blog, with permalinks in this format: http://domain.com/articles/46 This is our current .htaccess content: # Permalinks RewriteEngine on # Articles ...
0
votes
1answer
22 views

How to configure .htaccess to limit access for webpage?

I have website at phys_server1 (domain A) and payment.Gateway at phys_server2 (domain B). It is payment link (domainB/pay-here.php) at domainB (payment.Gateway). I have to open access to webpage ...
0
votes
0answers
34 views

Avoid redirect loop using htaccess or php

I have searched for my specific problem using google and your sites search engine, but found nothing similar to my task. I am rewriting via htaccess internally to point to the specific site content. ...
0
votes
1answer
34 views

How to redirect from ?page_id=… (apache)?

I have website at Wordpress. And it is webpage in Wordpress www.my-domain/?page_id=111 Now I need to create page outside of Wordpress (at the same server) and direct traffic to it instead of ...
0
votes
0answers
29 views

htaccess rule on a js file

in my public folder I have a javascript file, data.js that is being called from various parts of my app. I want to add a .htaccess rules to that directory so that whenever data.js is called, the ...
0
votes
0answers
73 views

Set cookie domain and cookiless subdomain

Sounds simple, but I'm having problems with it. I tried the suggestions in many articles, but it doesn't work for me. I've created a subdomain, static.example.com, to serve my static files from it. ...
0
votes
0answers
34 views

How do I 301 redirect - for all urls of my website to one single page

I have a website: www.example.pro with pages like: www.example.pro/contact-us/ and www.example.pro/about/ I want every URL from this website to redirect to: www.example.com Example: when opening ...
-1
votes
1answer
41 views

Apache mod_rewrite to Nginx rewrite

I have a virtual private server with whm/cpanel. I have installed nginx_admin plugin. The plugin has created virtual host files (example.com, *.example.com and manage.example.com) In my old apache ...
1
vote
2answers
941 views

Invalid command 'AuthType', perhaps misspelled or defined by a module not included in the server configuration

I'm trying to password protect the document root and all I get is an "internal server error" page. The Apache error log shows: Invalid command 'AuthType', perhaps misspelled or defined by a module ...
-3
votes
1answer
84 views

htaccess infinite loop caused by redirect 301 [closed]

I am trying to create a simple redirect however it is saying that it is caught in a inifite loop any ideas what I am doing wrong. I am wanting all requests from the root to a sub folder called ...
7
votes
1answer
7k views

Apache .htaccess <ifModule not allowed here

Running Apache on Ubuntu Precise, with PHP 5.5 Trying to access my var/www/ gives me a 500. /var/log/apache2/error.log shows: /var/www/web/.htaccess: <IfModule not allowed here my .htacess is ...
1
vote
1answer
141 views

Enable FastCGI on Litespeed

How would I enable my Litespeed server to process .fcgi files using a FastCGI module? I tried setting the handler to fcgid-script already but that doesn't work. Syntax: AddHandler fcgid-script ...
0
votes
0answers
16 views

folder exclusion from redirect to mobile site

I plan to exclude a folder www.mysite.com/ca-eng/pages/storesection/ on my full website from mobile redirection and unfortunately I do not have access to .htaccess file. My service provider charge me ...
2
votes
2answers
4k views

Can't gzip some JS and CSS files

I am optimizing a magento store, and some JS and CSS (compiled and minified in a MEDIA folder) aren't being served gziped as they should. All pages are gziped (ex. this HTML page) but some content ...
0
votes
0answers
21 views

Htaccess redirect all traffic https, except mobile. And rewrite to non-www [duplicate]

I'm trying to rewrite using htaccess all traffic over SSL (https). However my certificate gives an error on mobile, so I Want mobile traffic to go over the normal http protocol. This is my htaccess: ...
0
votes
1answer
48 views

Why Apache is delivering .htaccess files

I noticed my apache system is delivering .htaccess files although it shouldn't, due to: # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <Files ~ ...
0
votes
2answers
411 views

where to put wordpress htaccess on openshift

I have cloned my wordpress application from openshift with git, in my cloned application there is php folder, when i put my htaccess file in it then i commit my changes like this : git add -A git ...
0
votes
1answer
70 views

Forcing https redirect is rewriting all URLs to root directory and not appending latter half of URL

I'm forcing http to https with the following in .htaccess: ## Forcing https RewriteCond %{HTTPS} !^on$ RewriteRule (.*) https://website.com/$1 [R,L] Following that, I also have a redirect that ...
0
votes
3answers
6k views

Redirect all http AND https non-www URLS to https://www.example.com via htaccess

For reasons much too long and complex to get into (it involves several layers of corporate red tape resulting in someone else not purchasing a wildcard SSL certificate I requested), I have to set up a ...
0
votes
0answers
41 views

Regex validation : simple hotlink prevention while allowing search engines (and their localized versions)

I made and tested a simple hotlink prevention .htaccess and wanted to validate it here before putting it in production. <IfModule mod_setenvif.c> SetEnvIf Referer mysite\.com|localhost ...
4
votes
3answers
750 views

.htaccess redirect all extension to php

I recently updated my .htaccess file to hide the .php extension of the urls. It works nice, when I try to reach domain.com/index, it displays the php file. When I type domain.com/index.php it ...
-1
votes
1answer
35 views

.htaccess redirection for alias domain [duplicate]

I have two domains named www.example.com and www.example-alias.com , Both domain are pointing same location in the server. I need to do 301 redirection for www.example.com to www.example-alias.com ...
1
vote
1answer
150 views

Apache2: Allow directory indexing, but restrict file access by type

I need to configure my Apache2 server (version 2.2.22) such that I allow auto-indexing of the WWW root folder and its sub-directories, but restrict access (i.e. restrict download) to just a set of ...
1
vote
1answer
176 views

php htaccess environment variables php-fpm mod_proxy_fcgi apache 2.4

My .htaccess: SetEnv tvar "my value" RewriteEngine on RewriteRule .* - [E=boostpath:normal] My virtual host settings: AllowOverride All Options FollowSymLinks Require all granted ...
0
votes
0answers
30 views

.htcaccess RewriteRule without 301/302 error

I added the following Redirect-Rule to my .htaccess-file for my entire website: RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^([^\.]+)$ $1.php [NC,L] Basically it redirects URLs ...
-1
votes
1answer
95 views

“Simple” .htaccess rewrite for sites in subfolders not working [duplicate]

I have a catch-all Apache virtual host in /var/www/. In it, I have a index.php that handles all the code for pages, and subfolders holding the resources for each site (images, css, etc). I want a ...
0
votes
0answers
74 views

.htaccess rules for accessing subdirectory as document root

I'm using Magento on a LAMP stack. I have my primary store/application accessible from the root directory (e.g. website.com/). I have created a custom form for processing 3rd party vouchers at ...
0
votes
1answer
81 views

RewriteRule not working properly in my ubuntu server 14.04 running in Windows Azure

In my server I kept signup.php and in htaccess I kept this thing - RewriteRule ^registration/$ signup.php [nc] However it's working fine in my Windows machine running Wamp. But not ...
0
votes
1answer
90 views

htaccess conditional redirect to https

So i'm trying to redirect to https all visitors except my internal networks 192.168.x and 10.x RewriteCond %{HTTPS} off RewriteCond %{REMOTE_ADDR} !=(192\.168\.$|10\.$) RewriteRule (.*) ...
0
votes
1answer
74 views

301 Redirect Root and Only Root (“/”) from https to http

I have found several Q/As on how to redirect root only, how to redirect from https to http (using .htaccess). But there was no question that merged both. And this answer is too dirty: ...
0
votes
3answers
242 views

.htaccess isn't working

I'm trying to rewrite some URL's using .htaccess but nothing happens! I enabled the rewrite_module in Apache . I want to hide the .html extension from the Url using the following code in htaccess ...
0
votes
1answer
33 views

Restrict access to entire website except the homepage using .htacess

I have just put a website live, but I need to restrict access to everything except the homepage for users outside of my IP address. I would like to do this using .htaccess. So far I have come up ...
-1
votes
1answer
65 views

Tomcat app behind Apache, htaccess auth

Please help to set up a protection for Tomcat app with .htaccess. I want to use mod_proxy ProxyPass and ProxyPassReverse My tomcat app: www.example.com:8085 What I want is to make it impossible to ...
0
votes
0answers
76 views

Apache Gzip not compressing js files

I have enabled Gzip compression via adding the below to my .htaccess file: <ifModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ ...
0
votes
2answers
731 views

Why is .htaccess not allowed in a directory but is allowed in another?

I have apache2 installed on ubuntu 10.4 inside my var/www/ directory [amung others] I have a cakephp and a dvdcatalog directories. Each of which have CakePHP 1.3 installed. I can access them both ...
2
votes
1answer
236 views

Nginx rewite rules 403 error

I am having trouble with converting .htaccess files to nginx. I have 3 .htaccess files. The first .htaccess file is located in the document root and is as follows: Options +FollowSymLinks ...
2
votes
1answer
768 views

Apache deflate ignores javascript

I have set up deflate in my htaccess. Everything works fine, except for some reason javascript files are being ignored. I tried every possible combination of AddOutputFilterByType DEFLATE with ...
1
vote
0answers
14 views

.htaccess not working inside a firewall or proxy

I have a test site running with an .htaccess file defined like so: AuthName "test" AuthUserFile "/home/testdomain/.htpasswds/public_html/passwd" AuthType Basic require valid-user This requires a ...
0
votes
2answers
88 views

SetEnvIfNoCase Host: .htaccess to web.config conversion

I have tried IIS Manager and some online conversion tools but I can't figure out how to achieve the following .htaccess rules in a web.config file: SetEnvIfNoCase Host my-domain.com nopassreq ...
1
vote
2answers
2k views

server-status not working if allowoverride is set to all

in my apache config i have following settings <Directory "/opt/website/new-website-old/httpdocs"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from ...
0
votes
1answer
45 views

nginx .htaccess in two diffrent folders

I have a script that has 2 .htaccess files. The fist .htaccess file is in the root directory, and the second is in a folder under the root directory called upload. However, what I can not figure out ...