URL rewriting module for Apache web servers

learn more… | top users | synonyms (1)

4
votes
3answers
10k views

Apache2: 400 Bad Request with Rewrite Rules, nothing in error log?

This is driving me nuts. Background: I'm using the built-in Apache2 & PHP that comes with Mac OS X 10.6 I have a vhost setup as follows: NameVirtualHost *:81 <Directory "/Users/neezer/Sites/...
1
vote
0answers
27 views

Have both redirects for HTTP to HTTPS and canonical/aliases working together

I'm having issues with having both rules work at the same time, my conf file follow <VirtualHost *:80> ServerName mytest.domain.com ServerAlias www.mytest.domain.com mytest2.domain.com ...
-1
votes
1answer
32 views

Apache redirect to SERVER_NAME

Sorry for noob question. Apache 2.4 on Ubuntu 14. I'm seeing a lot of redirect answers that hard-code urls into them. I also saw an answer that includes Apache macro and variables. I want a simple, ...
5
votes
2answers
4k views

Understanding apache 2.4 mod_proxy_fcgi and RewriteRules in htaccess

We've recently switched one of our web servers to apache 2.4 and running PHP via php-fpm and mod_proxy_fcgi. Most everything works quite well, but there is one problem that I don't understand yet. One ...
1
vote
1answer
39 views

mod_rewrite issue Apache behind Nginx

I have nginx proxying to apache as a backend in order for nginx to handle static assets. Unfortunately when I attempt to visit a "pretty url" it just displays the index page. nginx config server { ...
0
votes
1answer
18 views

Implement apache equivalent mod_rewrite functionality in lighttpd

Here's the mod_rewrite .htaccess file which is meant to work on Apache Servers for my web-app RewriteEngine On RewriteBase /cs200/tokens/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{...
1
vote
1answer
54 views

Force HTTP on all pages except specific URLs

I have a situation where I need to force every single page in my site to redirect to HTTP except for two specific URLs which need to force redirect to HTTPS. The two pages that need to redirect to ...
0
votes
1answer
43 views

How to read specific character out of request header in apache http.config

We are trying to read specific character out of http request header to determine the type of URL it needs to be forwarded it. E.g., Http header - HTTP_ACCEPT=version.ver1+xml In Httpd.config, we ...
0
votes
0answers
11 views

Most compact and speedy mod_write map?

I am storing a list of paths in a mod_rewrite map. With 4MB and 120000 entries, it seems prudent to use a RewriteMap with a dbm format, instead of a plain text file. Apache seems to support multiple ...
-1
votes
1answer
49 views

Proxy pass to multiple sub domain in apache 2.4

In my webserver (Ubuntu 14.04), I have installed Apache 2.4, tomcat 7 and shiny web framework. I want to use Apache 2 to server all my webpages. So I use JKMount to set sub directory tomcat_demo for ...
1
vote
1answer
555 views

Use custom environment properties from Elastic Beanstalk for htaccess

Is there a way to use the custom environment property of elastic beanstalk in htaccess? I only want to rewrite http to https when not running locally so I thought I could do this by using the ...
3
votes
1answer
767 views

Changing a Set-Cookie header using mod_rewrite/mod_proxy

I have a bunch of CGI scripts, which are served using HTTPS. They can only be reached on the intranet, not from the outside. They set a cookie with the attribute 'Secure', so that it can only be send ...
0
votes
0answers
25 views

RewriteCond fails on existing file

So, my .htaccess file starts with: Options -MultiViews RewriteEngine on RewriteBase / And I tried: RewriteCond %{REQUEST_FILENAME} -f or RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f or ...
1
vote
0answers
36 views

Apache rewrite rule 403 error

I'm running Apache 2.2.15 with rewrite_module installed. I have rule in my vhost.conf as follows; RewriteRule \n ^/advanced/selector/profiles/([A-Za-z0-9]+)/?$ \n "/advanced/selector/profiles/...
0
votes
3answers
197 views

How to make Apache’s mod_rewrite redirect over HTTPS by default?

Let’s say I have a website that is available over HTTPS, e.g. https://example.com/foo. Consider the following .htaccess: RewriteBase / RewriteEngine On RewriteRule ^foo$ bar [R=301,L] Now, when I ...
0
votes
1answer
45 views

Without using mod_rewrite, what is the best way to redirect all subdomains to https? [duplicate]

I am currently using mod_rewrite to redirect all subdomains to https, but multiple sources have suggested that Using mod_rewrite to do this isn't the recommended behavior. See RedirectSSL The ...
0
votes
0answers
109 views

Fix ERR_TOO_MANY_REDIRECTS after adding trailing slash in URL

I have a Magento website hosted in a managed server where we need to use two .htaccess files, the first one is needed to redirect all request to a subfolder /current/src/ and is placed directly in ...
8
votes
6answers
14k views

apache server-status not found. check if mod_status is enabled

I've enabled the apache_ plugins on a munin node: ln -sv /usr/share/munin/plugins/apache_* /etc/munin/plugins/ After restarting the node with service munin-node restart here are the errors I'm ...
1
vote
0answers
33 views

Hide index.php in subdirectory after rewrite (lighttpd)

How it is set up now I have a website which is setup for clean urls with apache mod_rewrite like this: RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] RewriteCond %{...
1
vote
1answer
25 views

need the name of http_host for a htaccess rewrite condition

I want to write a rule where I don't know the exact http_host. For example I have (www.)?example.com. Now I need example to build the following: (www.)?example.com/example/... in a RewriteRule. So ...
1
vote
2answers
9k views

Can Apache rewrite a request's Host header based on the URL?

Apache is a reverse-proxy to my app. A client requests http://cdn.example.com/foo/images/logo.png: GET /foo/images/logo.png HTTP/1.1 Host: cdn.example.com I want Apache to modify the request so ...
0
votes
0answers
21 views

Apache rewrite rules in both config and .htaccess

I have a CakePHP application hosted in a virtual host (Apache 2.4) which works OK. Now in the internal network where the virtual host name cannot be routed so I have to use the web server IP. And ...
0
votes
2answers
66 views

apache 2.2 mod_rewrite redirect some urls to https and force http for others

I have my page at a shared host. In general the site is reachable using http and https. The page serves ads and most of the ads are not available using https therefore I only want the admin parts to ...
0
votes
0answers
75 views

Backreferencing a cookie value in rewriterule

I'm trying to backreference a cookie's value in a RewriteRule : # Trace rewrite rules log LogLevel alert rewrite:trace4 # Rewriting the URL, in the cookie's condition i've tried en alone, and en|fl|...
1
vote
1answer
19 views

Issues with rewriting all http and https domain traffic to https based url

I am trying to get all variation http://www.example.com http://example.com https://www.example.com https://example.com www.example.com example.com to all redirect to https://www.example.com I ...
3
votes
1answer
788 views

Htacess rewrite for AngularJs App

I need help regarding AngularJs application. I need htacess file for HTML5Mode in AngularJS and Hashbang fallback. Can someone help me? Cuz i get %2F when i use backslash. I've been folowing along ...
0
votes
1answer
100 views

url rewrite, nginx throw 404 errors, nothing in error logs

below rewrite works fine: rewrite ^/city/restaurants$ /city/listings/restaurants permanent; but this doesnt work rewrite ^/city/restaurants$ /city/listings/restaurants last; rewrite ^/city/...
1
vote
2answers
6k views

htaccess rewrite gives LimitInternalRecursion error

I have a .htaccess file with the following code <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ http://%{...
0
votes
0answers
40 views

How to block referral source on apache with special characters?

I've been getting referral spam on my site. I've tried several options to block it, but it still hits it. I think it has to do with being special characters on the referral? This is the referral ...
0
votes
1answer
241 views

Apache redirect - let's encrypt SSL certificate redirecting to naked domain rather than www

I recently set up a new website running off Wordpress which is working nicely. Since I wanted to have an SSL certificate for the website I thought I'd use Let's Encrypt since I've been hearing a lot ...
7
votes
2answers
6k views

How do I make all URLs run through a single PHP file?

How do MVC systems where the urls are in these forms force all the requests through a single index.php file? http://www.example.com/foo/bar/baz http://www.example.com/goo/car/caz/SEO-friendly-name-of-...
1
vote
1answer
1k views

htaccess - Wildcard subdomains to subfolders

So the idea is that I have: domain.com/.subdomains/domain1 (2,3,4,etc) And I want to map: domain1.domain.com -> domain.com/.subdomains/domain1/ domain2.domain.com -> domain.com/.subdomains/...
0
votes
1answer
46 views

Redirecting all requests on one domain to https non-www

I have an ISPConfig 3 site running on one domain. I have multiple vhost files for the different applications I run through Apache. I want to enable https://example.com/%QUERY_STRING% on every request ...
0
votes
0answers
23 views

Apache redirect to https from multiple domains

I have a virtualhost with multiple domains that point to it (servername and alias). I find a solution to redirect every domain to https:/ /example1.com and works fine. But now, i want to redirect also ...
0
votes
0answers
5 views

Rewrite subdomain path to absolute path using htaccess [duplicate]

I need some help with htaccess to redirect a subdomain path to a totally different subdomain path. Example: http://support.domain.com/need/help --> http://blog.domain.com/8212/need-help I was ...
3
votes
1answer
144 views

Apache Directives Ordering: Global, Pre-VHost, or in Directory blocks

I'm setting up my first virtual server from scratch (provider name omitted but it's a 'droplet'). I've been using WHM for a while and I feel I'm fairly familiar with it. Specifically, it's a Debian 8 ...
2
votes
2answers
230 views

Special characters in URL causes custom redirect to fail

I have a domain on which I am trying to set custom redirects for the error pages. My .htaccess file looks like so: RewriteEngine On AddDefaultCharset UTF-8 DefaultLanguage en-US # disable TRACK and ...
0
votes
0answers
46 views

mod_rewrite index.php behind varnish server

I have on my pfSense router a Varnish server currently with 4 backends. 3 of the backends go to the same server on my network and the 4th goes to my development server I'm using to get some webapps ...
0
votes
1answer
165 views

How to Handle Routes of Two Laravel Projects on One Domain or Server?

I'm working on a project divided into two separate parts. Part one, the bigger part, is in Laravel 4.2. Part two, the shorter part, is in Laravel 5. Both are on the same server. My goal is to access ...
5
votes
3answers
1k views

Difference between “Redirect permanent” vs. mod_rewrite RewriteRule

This is an Apache httpd 2.2 server. We require that access to this webserver be encrypted by HTTPS. When web clients visit my site at http://www.example.org/$foo (port 80), I want to redirect their ...
0
votes
2answers
85 views

“deny all” for all files in a directory

My server is getting hit hard by bots, etc., looking for various files in /cgi-bin/, like search.cgi, YaBB.pl, gitweb.perl, perl, gitweb.pl, htsearch, and on and on. I want to deny all access (send a ...
0
votes
1answer
45 views

htaccess - insert php script name into all URLs

I have an application which requires an htaccess file in the directory /tileserver/ that contains the following: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 ...
0
votes
1answer
45 views

Apache mod rewrite to block xhr requests

I've observed that xhr requests getting redirected to oauth servers is a bad thing (b/c it's a robot and it can't respond to the request). It also seems that responses responses meant for people and ...
0
votes
2answers
47 views

Apache URL masking

I need to access http://www.domain.com/uri-path-to-resource.rsc in the browser, but to display the content from http://shop.domain.com/uri-path-to-resource.rsc. Unfortunately ProxyPass could not be ...
0
votes
1answer
50 views

apache allowoverride points to wrong location

I installed a Slim framework to create a API and located this under /opt/modul/www/api index.php slim/ so the index.php is my main API file. And I want to access this in the browser under ...
-2
votes
2answers
75 views

apache virtual host config

hi im trying to ensure that my website is only accessed via https, and only through the www sub domain, im currently using the following apache virtual host config: <VirtualHost *:80> ...
1
vote
0answers
24 views

mod_rewrite and double slash issue

I am getting mod_rewrite and double slash issue can you please help me out. # ProxyPass /balancer-manager ! RewriteRule /phoenix/^(.*) http://phoenixstagingappa.scan-shipping.com:...
0
votes
1answer
54 views

Apache Mod Rewrite - exclude folder and subfolders, except for one subfolder

I have a Mod_Rewrite setup as follows: RewriteCond %{REQUEST_FILENAME} !^/www/live/site.name/app/public/(/forms/|/crm/) RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f ...
0
votes
1answer
24 views

How is leading slashes handled in server and in client?

I am trying to create a RewriteRule, but it's unreliable and I can't figure out what is happening. Here's my rule: RewriteRule ^docs/(......)/$ index.php?docid=$1 [L] the problem is leading slashes,...
0
votes
1answer
36 views

Correct way to block a site if a cookie isn't present apache 2.4

I'm using apache 2.4.12 (Ubunutu 15.10) as an oauth2 proxy behind a node app. The app sends lots of unauthenticated requests before login b/c it doesn't know it's not authenticated (it doesn't know/...