Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

-1
votes
1answer
38 views

What's the RewriteRule in htaccess to redirect to a different port? [duplicate]

I want to redirect all the request like url/api/something to a different port (say 8000) with the same base URL RewriteCond %{REQUEST_URI} ^/api/\w*$ [NC] RewriteRule ? What is the RewriteRule? ...
0
votes
0answers
14 views

.htaccess rewrite sub directories as url query [duplicate]

I have .htaccess file in my root directory of the server. All the web pages in the server are in directories, like /Animal/Dog.php (the page can also be used without the extension). There are no ...
0
votes
2answers
57 views

Can Apache be configured to ignore corrupt .htaccess files but respect them if they are correct?

I have a program writing and updating some RewriteRules in an .htaccess file (the main config is in the vhosts section). This works fine most of the time, but sometimes the file gets corrupt. When ...
0
votes
3answers
240 views

Apache permanent redirects [duplicate]

how can i redirect two domain on the same server.. let say this domains http://www.game.com -> http://www.games.com http://game.com -> http://www.games.com http://games.com -> ...
-1
votes
1answer
29 views

apache disable unconfigured subdomains [duplicate]

There is a webserver which has example.com, www.example.com, my.example.com, shop.example.com, static.example.com. All sites except www.example.com is on https. My problem is when I type ...
1
vote
0answers
18 views

RewriteBase in httpd.conf + RewriteRule in .htaccess? [duplicate]

RewriteBase is set in httpd.conf for an alias: Alias /test /home/user/test <Directory "/home/user/test"> AllowOverride All Allow from All RewriteEngine On RewriteBase /test ...
1
vote
1answer
54 views

Apache2 htaccess issue [duplicate]

I'm currently having issues with getting Apache2 to recognize an .htaccess file. I'm currently running the server locally on my machine for testing purposes. I can get my index page to load up ...
1
vote
1answer
678 views

Configuring htaccess/mod_rewrite to serve static files with question mark in the URL

I've just taken on hosting of an ancient site that was converted from asp to static html, consisting of about 6,000 files. However, my server doesn't like the filenames, giving a 404 error. The URLs ...
-1
votes
1answer
55 views

Block Wildcard User-agent

how can i write rewrite condition for wildcard user agents here is the code I'm trying but doesnt work RewriteCond %{HTTP_USER_AGENT} !*uTorrent* [NC] RewriteCond %{HTTP_USER_AGENT} ...
0
votes
1answer
89 views

htaccess to Allow Downloads from Specific User agent and HTTP Referrer [duplicate]

i want to allow some files to be downloaded if only the user agent or referrer match the following These are the user agents uTorrent *Bittorrent* Transmission This is the http referrer ...
1
vote
0answers
59 views

403 error from 403 ErrorDocument

I've the following configuration script in my Apache 2.4.7 installation: <Directory "/www"> Options Indexes FollowSymLinks AllowOverride All <RequireAll> Require all ...
-1
votes
1answer
52 views

Apache htaccess get subdomain and prepend it to path [duplicate]

this is my first question on ServerFault and I think I couldn't find a similar one. To the point. I would like to achieve the following using my .htaccess. subdomaina.example.com/stats/ -> ...
0
votes
1answer
132 views

How to rewrite /index.php to /app.php [duplicate]

I have this in my .htaccess file: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteEngine On ...
0
votes
2answers
53 views

.htaccess errordocument disable header

I want to redirect error to specific page, so i wrote: ErrorDocument 403 /error403.html This is working, but in the HTTP response header I can still see HTTP/1.1 403 Forbidden. Some browsers ...
0
votes
1answer
71 views

convert lighttpd to nginx rewrite rules

I'm trying hard to make my code work on nginx. This configuration works with lighttpd but I want migrate it to nginx. Rewrite rules on lighttd : url.rewrite-once = ( "^/(ui)/(.*)$" => ...
0
votes
1answer
737 views

Help With Infinite Redirect From .htaccess using MVC with PHP [duplicate]

Let me preface by saying that I'm fairly new to .htaccess authoring and have usually left the nitty gritty up to my hosting provider. I've recently decided to implement a hand rolled MVC framework in ...
0
votes
1answer
60 views

activate htaccess only on specific URI

I have an apache webserver running on an ubuntu system. To avoid access for unauthorized users, I have an active .htaccess: AuthType Basic AuthName "own area" AuthUserFile /path/to/.htpasswd require ...
0
votes
1answer
166 views

Block file from accessing using .htaccess for a subdomain

I have a website for e.g. www.domain.com And I have another subdomain for e.g. test.domain.com Both my main and subdomain point to same directory which is public_html. I want to block access to ...
0
votes
0answers
62 views

Why do AuthType Basic directives not work in .htaccess

I have a web server running on ClearOs 6. I would like to protect a couple of directories using .htaccess, but I do not seem to be prompted for a password at all. Relevant bits of conf file are: ...
-1
votes
2answers
965 views

application/x-httpd-php opening rather than pages?

For some reason, no matter what page I try to open (.php, .html, .html, etc) my server trys to save it, rather than displaying the page. However, I do get the "It Works!" page for the main domain, ...
4
votes
2answers
353 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
vote
2answers
303 views

Redirect Multiple Domains to Subfolders and Hide the subfolder from URL

I have sat up two virtual host on the same ip and same document root with Apache, because I want to use shared files and contents in the document root. I want my second website point to a subfolder ...
0
votes
1answer
126 views

Rewrite rules for Anchor CMS on Lighttpd

I installed Anchor CMS on my server running Lighttpd, and I am trying to setup pretty url's. I have anchor installed in a sub-directory "/blog". The htaccess file that works with anchor cms in ...
0
votes
1answer
29 views

Use htaccess to alias to different hosting

I have a host my.site.com that doesn't support a PHP version that I need, so I got some new hosting at newsite.com that has a more up to date PHP version. I'm going host the site completely on ...
0
votes
1answer
311 views

Apache 2.4: Public Subdirectory with .htaccess

I'm currently upgrading to Apache 2.4. What puzzles me right now is how to create a public subdirectory using .htaccess only. The outer directory is protected by AuthType Basic Previously, the ...
0
votes
1answer
49 views

301 permanent redirection changing URL structure [duplicate]

I changed category urls on site. Old are like this: www.example-name.com/category-name-exactly-same-keywords/ ...
0
votes
1answer
40 views

.htaccess overwrite the deny ip list and allow a one single ip in any case?

in .htaccess i have following entries to block some certain country ip's however list is so long, its impossible to match a ip address pattern in there one by one for certain ip address, but i want ...
0
votes
1answer
77 views

404 returned though rewrite rule is matched

I have one rewrite rule that sends all requests to index.php: RewriteRule ^.*$ index.php [NC,L] (Apart from RewriteEngine On, that's all there is in the .htaccess file) It works, unless the ...
0
votes
0answers
84 views

Mod-Rewrite - going from plain url to one with special characters

I am having a little issue with FreeBSD 10 RELEASE and Mod_Rewrite when it comes to special characters -- not in the source URL, but in the destination URL. The vast majority of Mod_Rewrites that I ...
0
votes
1answer
81 views

.htaccess HTTPS for all except specific files

I have a problem with a redirect in my .htaccess-File. Basically I want to send all requests to the HTTPS, which works perectly: RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ ...
0
votes
0answers
26 views

After migrating to Plesk 11 / Apache 2.2.15, some rewrite rules ignored [duplicate]

First, thanks in advance for any insight. We recently migrated to Plesk 11 / Apache 2.2.15. After doing so a number of our rewrite rules no longer work as expected. For example, this no longer ...
2
votes
2answers
440 views

Block bots by their Java referrer or User-Agent string?

I have been getting a lot of web hits in my logs that crawl most top level pages of my site and show a referrer as a Java version. I see different variants of the Java versions in the referrer, i.e. ...
0
votes
4answers
1k views

Varnish / Apache redirecting to backend port 8080

I'm running Varnish 2 with Apache backend at 8080 on the same machine. Everything is working fine, except one problem: Sometimes Apache(?) is redirecting to backend port :8080 especially when I'm ...
2
votes
1answer
1k views

Unable to set php_value in .htaccess file

I am trying to set up NewRelic on my Apache2/PHP server, and have it report different applications per vhost. To do this, the php value newrelic.appname must be changed. It is defined by default in ...
-1
votes
1answer
50 views

redirect for root domain only not subdomains [duplicate]

I would like to redirect my root domain to another site, but leave the subdomains in tact. so redirect mydomain.com to mydomain.com/directory, but leave alone subdomain.mydomain.com. Will this ...
1
vote
1answer
304 views

How to enable compression with mod_deflate

Page speed insights tells me to enable compression for google-maps source. It recommends to use mod_deflate if using Apache. Well, I've put the next snippet code inside the .htaccess file: ...
0
votes
0answers
110 views

Rewriterule not working on localhost, works fine on server

I'm trying to get rid of .php extension from my webpages. Here's my .htaccess file's code RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ...
0
votes
1answer
50 views

Use .htaccess rewrite rules on Microsoft IIS

In the last few days there's been reports [1][2] of an attack targeting WordPress sites. In this blog post it is described how to mitigate automatic login attempts using .htaccess with the following ...
-1
votes
1answer
25 views

Redirecting url with .htaccess [duplicate]

I'm trying to redirect http://example.com/forum/index.php to http://example.com/forum/ and it will not work. Here's the code I'm using in my .htaccess. What am I doing wrong? Redirect forum/index.php ...
5
votes
1answer
893 views

Apache 2.4 with PHP-FPM .htaccess redirection

I have Apache 2.4 set up with PHP-FPM on a server. To pass from Apache to PHP-FPM I use the following: ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9001/hosting_files/site.com/admin_secure/$1 ...
0
votes
1answer
40 views

Apache files directive for single file

I'm trying to restrict access to the wp-login.php file of a wordpress installation to a single IP address using the following .htaccess directive: <Files wp-login.php> order deny,allow ...
0
votes
0answers
36 views

Custom rewrite rule - migationg to WordPress CMS

I am trying to move my image gallery site from one CMS to Wordpress. On current CMS I have page with medium size image on it with URL: ...
-1
votes
2answers
1k views

Authenticat users with LDAP and Apache 2.4

i would like to setup a LDAP Authentication with Apache 2.4. LDAP Sever is a Windows 2008. My .htaccess looks like: AuthType Basic AuthName "Login" AuthBasicProvider ldap AuthLDAPBindDN ...
0
votes
1answer
52 views

htaccess: Only allow file access via the complete path, not the rewritten one

In my setup i have my CMS reside in a subfolder /sub and i rewrite all the access to the root to this subfolder: ## Rewrite www.example.com to the CMS home page: www.example.com/corporate/index.php ...
0
votes
0answers
41 views

GZIP compression for merged and specific files

My Website is using a CMS (Typo3) that has the feature to merge and compress all JavaScript and CSS Files. With htaccess i also enable the server side gzip feature which will work fine. But it seems ...
3
votes
3answers
66 views

Does high traffic on HTACCESS affect the server?

i have a website and a sub domain.. the main website is hosted in server A and its sub domain in server B.. main website = server A sub domain = server B when i have high traffic i will ...
0
votes
1answer
86 views

Converting Drupal Boost .htaccess to Nginx

I'm trying to install Boost module to work with nginx. As we know Boost does not generate nginx directives just like Apache. Boost has the following directives for Apache's .htaccess: ### BOOST ...
0
votes
1answer
206 views

use .htaccess to change the url example.com/mobile to m.example.com

I have am setting up a social network script, it has both a desktop and a mobile version of the site. When a mobile device tries to browse the site, the mobile page is served with the url ...
0
votes
2answers
66 views

getting started with apache mod_rewrite on a virtual host [duplicate]

hey SO I am attempting to use apache's mod_rewrite module to do some basic rewrting of url on my website so they become a little more seo friendly basically I have a virtual host file that look ...
-4
votes
1answer
105 views

How to change .htaccess file to work right in localhost? [closed]

I have this snippet code in my .htaccess file to prevent users from hotlinking the server's images: RewriteEngine On RewriteCond %{HTTP_REFERER} ^$ [OR] RewriteCond %{HTTP_REFERER} ...