The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
0answers
9 views

Apache rewrite rule for multiple named virtual hosts with a 'catch all' rule

I have a redirect apache server that I setup for about 30 domains. I want to have all requests get redirected to the main server except for 1 domain. Basically any domain coming to this server gets ...
0
votes
1answer
41 views

apache rewrite rules, non-www, https

I have two applications on the same server and use apache rewrite rules to redirect: www requests to non www http reuests to https Everything works ok, except one case: request www.test2.test.eu ...
0
votes
1answer
35 views

Converting htaccess rewritecond to nginx

I'm very new to nginx, but have previous experience with apache redirects. I converting a subdomain to a subfolder and need some help with getting my rewrite rules correct for my switch. The subdomain ...
0
votes
1answer
19 views

Route request to Tomcat only if file doesn't exist on disk

I have Apache in front of my Tomcat installation as a reverse proxy. Most URLs are routed to Tomcat by a JkMount directive in Apache. For one URL pattern I'd like Apache to route requests to the ...
0
votes
1answer
29 views

Nginx and complex URI rewrites

I'm having problem with getting logic behind Nginx rewrites. Are they supposed to be in server or location directive? I need to rewrite one long and scary URL to another. Is there anyone who can ...
0
votes
1answer
54 views

apache rewrite rules for multimple domains | https://www

I have two applications configured on one apache (eg. example.com and test.net). Rewrite rules for those apps are the same (so in config file for domain example.com I've got this rules, and the same ...
-3
votes
2answers
49 views

Apache redirect to parent folder [closed]

I have a server pointing to DocumentRoot /var/www/mysite I would like to redirect all requests from /var/www/mysite/folder/ to /var/www/mysite/ I tried the following: `RedirectMatch ...
0
votes
3answers
54 views

How to remove hypen (-) using nginx rewrite rule?

I am using this rewrite rule to redirect example.com/a-b-c?id=learn-more ----> http://example.com/abc?id=learnmore rewrite ^/a-b-c?id=learn-More http://example.com/abc?id=learnMore permanent But ...
0
votes
1answer
363 views

Apache rewrite using THE_REQUEST for rewriting GET requests only

Background: In order to reduce repo size of git repos containing wordpress installs, we are removing static assets from the repo. The bulk of the work is done, but I have a snag. I've relocated the ...
0
votes
1answer
155 views

VirtualHost Redirect should work with new RewriteBase

Inside the VirtualHost I got this redirect: RewriteBase / RewriteCond %{REQUEST_URI} wp-content/uploads/([^.]+\.(jpe?g|gif|bmp|png))$ RewriteRule (.*) http://example.org/$1 [R=301,L,NC] So the full ...
0
votes
0answers
28 views

apache restrict foreign domain and redirect subdomains

I want my server to block requests which are not addressed to my domain including subdomains. The same way I want that not existing subdomains (*.domain.de) are redirected to "www.domain.de". ...
-1
votes
1answer
153 views

Rewrite only if Image don't exists with .htaccess

How do I make RewriteCond+RewriteRule change site1.com/folder1 to site2.com/folder1, only if file in this directory don't exist. For example: site1.com/wp-content/uploads/2014/03/image.jpg If image ...
-1
votes
1answer
94 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
0answers
35 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 ...
0
votes
0answers
96 views

Avoid directory traversal attack with RewriteCond

this may seem a pretty stupid question, but I want to make sure I'm not doing anything wrong. I have an Apache web server (2.2.26) that acts as a front-end for my application. It servers the static ...
0
votes
0answers
28 views

mod_rewrite Multilevel directories with pagination [duplicate]

I am trying to build rules for multilevel categories with pagination. Now, if there is no page input, it doesn't work. www.site.com/category/level1 www.site.com/category/level1/page=5 ...
1
vote
2answers
72 views

How to use mod_rewrite to abstract get request with subdomains

I've been at this all day and I thought I had a handle on regular expressions but I'm no longer confident that I do. I've searched all over, read through some horrible guides on mod_rewrite and I'm ...
1
vote
0answers
268 views

How to rewrite using htaccess if the file exists in another folder?

We are trying to rewrite to another folder if the file does not exist in the document root, but does exist in the other folder. The other folder is in a completely different location, which is ...
0
votes
1answer
206 views

htaccess rewrite condition old site to new site with querystring

I am not even going to pretend to fully understand how htaccess rewrite conditions work. I've been working on this for a while searching and searching. I have an old Wordpress site www.old-site.com ...
-3
votes
2answers
259 views

Mod Rewrite code with out changing the url in address bar

I When I call http://www.mysite.in/abc/xyz it shoud show up http://www.mysite.in/abc/xyz/index.php but the url shout not change in address bar and it should work with out "/" in the address. Please ...
0
votes
0answers
71 views

How do you exlcude a sub-directory from an Apache rewrite ruleset?

I have a multilingual site with the root being English and a sub-directory (/es/) being a human translation into Spanish. Instead of manually updating all URLs, I have a opted to use mod_rewrite to ...
0
votes
1answer
228 views

SSL/TLS Client certificate Authentication using RewriteCond and Rewrite Rules to perceptively redirect traffic not authorized

I finally end up to write here because I´m badly struggling against apache, SSL/TLS and a client certificate authentication that should use the certificate´s Serial Number to restrict access to a ...
1
vote
1answer
147 views

RewriteCond always match incorrectly

If I write: <?php echo "SCRIPT_NAME: ".@$_SERVER['SCRIPT_NAME']."<br />"; ?> SCRIPT_NAME: /index.php The line above is showed. I'm using these rewrite lines RewriteCond ...
1
vote
1answer
801 views

ProxyPass if RewriteCond is TRUE

At proxypass configuration file I have written this line ProxyPass /directory/ ajp://localhost:8009/directory/ It works perfectly At htaccess file RewriteRule ^seconddirectory/(.*)$ ...
0
votes
1answer
2k views

RewriteCond not matching on my IP when matching on %{REMOTE_ADDR} [duplicate]

I want a mod_rewrite rule not to be executed when traffic is hitting the web-server from internal network. The web server is an apache 2.2 The following RewriteCond is meant to guard the rewrite rule. ...
-1
votes
1answer
225 views

Apache rewrite rule infinite loop for subpage [duplicate]

I am trying to redirect toast.allthesmarts.com to toast.allthesmarts.com/dayone RewriteEngine on RewriteCond %{HTTP_HOST} toast.allthesmarts.com RewriteRule ^(.*)$ ...
0
votes
3answers
4k views

How do I make RewriteCond %{HTTP_COOKIE} match a cookie value exactly? [duplicate]

How do I make my rule match an exact value of a cookie? I've tried: RewriteCond %{HTTP_COOKIE} ^its=me$ [NC] RewriteCond %{HTTP_COOKIE} its=^me$ [NC] RewriteCond %{HTTP_COOKIE} its="me" [NC] ...
0
votes
1answer
42 views

Apache 301 redirect in vhost

I wish to redirect(301) a url if the url dont have a string present in it. eg: http:://example.com must always redirected to http:://example.com/en http:://example.com/test.html must always ...
0
votes
1answer
144 views

RewriteRule (to remove .php) and old redirect 301 not working?

I'm not experienced in editing .htaccess I wanted to redirect non-www to www. remove .php extension set up a custom 404 page I managed to do this (looking for solution in the web and on ...
0
votes
1answer
124 views

Apache internal redirect limit reached

I have following problem: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel ...
1
vote
2answers
736 views

Redirect to a URL via htaccess if index.(html|php) doesn't exist

Is it possible to redirect (via a Rewrite Cond?) users to another URL for help if an index.html or index.php file doesn't exist within their home directory? Thanks Greg
1
vote
1answer
493 views

phpMyAdmin rewrite for nginx

I am trying to configure Nginx so that I can access PhpMyAdmin from a subdirectory (aka domain.com/phpmyadmin). The code provided below seems to work for me although I don't want the alias to be ...
0
votes
1answer
99 views

Redirecting all pages except for a select few back to HTTP

I'm using the rewrite rules below to redirect 2 php pages to https (to protect user data), but whenever I click on any links on those php pages they redirect with https enabled and the page does not ...
0
votes
1answer
128 views

existing file gives 404 due to a RewriteCond rule in .htaccess

To redirect a specific domain name to a folder in my public dir, www/, I edited .htaccess to the following: RewriteEngine On RewriteCond %{HTTP_HOST} ^(.+)?domain.com$ RewriteRule ^(/)?$ ...
1
vote
1answer
327 views

Prevent redirect loop in mod_rewrite

I'm writing a rule in my htaccess that basically says this: If the request is for the homepage And a cookie has not been set Rewrite the page with /addCookie.php Then in addCookie.php, we set the ...
1
vote
1answer
184 views

RewriteCond for multiple files

In htaccess file, RewriteCond for one file bla.php can write so right? RewriteCond %{REQUEST_FILENAME} !bla.php Question: how can write RewriteCond for multiple files? for example for 3 files: ...
0
votes
2answers
511 views

Apache mod_rewrite redirect with prefix

I am newbie with Apache's mod_rewrite and I'm having some difficulties getting it to do what I want. In my static directory, I have some javascript files (.js) with 2 kind of filename: xxxx.js ...
0
votes
1answer
65 views

mod_rewrite to a folder except for a set of domains

Could anyone help to with the following issue: I'm trying to do a rewrite on all domains that won't match and push them to a given folder. The following vhost works locally (Mac OS X with XAMPP), but ...
3
votes
1answer
195 views

Trouble with www. redirect (.htaccess)

I'm trying to get a simple www. to non www. redirect set up. Here's the .htaccess DirectoryIndex index.php RewriteEngine On RewriteCond %{HTTP_HOST} ^www.domain.org [NC] RewriteRule ^(.*)$ ...
1
vote
1answer
157 views

Apache2 - Forward a value from URL param OR cookie, whichever is present

I managed to use apache to strip off a url param and stuff it in a header to be passed on to another server. See this question for reference. Now I would like to add to this by getting the value for ...
0
votes
2answers
153 views

RewriteCond and the www record

In my httpd.ini I redirect all traffic from "example.co.uk" to "www.example.co.uk", the below works fine for this: RewriteCond %HTTPS off RewriteCond Host: (?!^www.example.co.uk)(.+) RewriteRule ...
0
votes
1answer
2k views

Multiple RewriteCond doesn't work

I have in htaccess some like this: RewriteCond %{HTTP_HOST} !^foo RewriteCond %{HTTP_HOST} !^bar RewriteCond %{HTTP_HOST} !^some RewriteRule ^register,(.*)$ /register.html [R=301,L] RewriteRule ...
0
votes
1answer
309 views

Apache Rewrite not rewriting as expected

I'm trying to use mod_rewrite to redirect users to the HTTPS equivalent URL unless the URL is for my Jenkins CI server. Here is the rule I have in my default site config (my Jenkins and other sites ...
0
votes
1answer
582 views

.htaccess: Backreference in RewriteCond to check for file existence?

I'm trying to match URLs of this type: http://www.example.com/image/12345 I'd then like to check whether this file exists: http://www.example.com/files/image_12345.jpg If it does, I'd like to ...
0
votes
3answers
354 views

www vs. non-www and subdirs with special .htaccess

In my root folder, the following captures https://example.org and http://example.org and redirects to its respective version (http or https) with the www added back in. (It's a requirement they had ...
0
votes
1answer
75 views

mod_rewrite adds .html when redirecting

I have a redirect situation where the site is part dynamic and part generated .html files. For example, mysite.com/homepage and mysite.com/products/42 are actually static html files Whereas other ...
4
votes
1answer
1k views

How do I reset Apache's RewriteCond directive?

I have some Apache configuration like this: # Image hotlinking rule RewriteCond %{HTTP_REFERER} ^http://badsite\.com/ RewriteRule .*/static/artwork/.*\.(jpg|png)$ /static/images/hotlink.png [L] # ...
2
votes
1answer
177 views

apache httpd keep sending http requests to strange IPs

Recently I noticed my server keeps sending data to strange location "121.11.76.48" by netstat -na . To find out what it is sending , I tried : tcpdump -i eth0 host 121.11.76.48 -nnvvXSs 1514 And ...
0
votes
1answer
115 views

Redirect URL including folder path

I have the following rewrite rule setup: rewritecond %{http_host} ^domain.com [nc] rewriterule ^(.*)$ http://domain2.com/$1 [r=301,nc] Now this works for redirecting domain.com/index.htm to ...
1
vote
2answers
84 views

Serve PHP page in web root but show contents in subdirectories

I have a web site on a shared hosting server. My directory layout looks like this /home /user /public_html /pics /family There is an index.php file in ...