The tag has no wiki summary.

learn more… | top users | synonyms

4
votes
1answer
987 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] # ...
3
votes
1answer
174 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 ^(.*)$ ...
2
votes
1answer
149 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 ...
2
votes
1answer
6k views

How to exclude one subfolder from my RewriteRule Htaccess rules?

I have a .htaccess in my root of website that looks like this: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mydomain\.pl [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?([a-z0-9_-]+)\.mydomain\.pl [NC] ...
2
votes
1answer
121 views

unique .htaccess question about mod_rewrite and RewriteCond

I have a few rewrite rules like these RewriteRule ^dir/(.*)-something.html otherdir/file1.php?var1=val&var2=$1 [L,NC] RewriteRule ^dir/ otherdir/file2.php?var1=val [L,NC] dir/ is not a real ...
2
votes
1answer
2k views

How to exclude a sub-folder from HTaccess RewriteRule

I have WordPress installed in my root directory, for which a RewriteRule is in place. I need to password-protect a subfolder ("blue"), so I set the htaccess in that folder as such. Problem is that ...
1
vote
2answers
4k views

One RewriteCond for multiple RewriteRules

I need to preserve all user query strings. RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^$ index.html?page=home&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^about$ ...
1
vote
2answers
519 views

htaccess .html rewrite exception

Ok guys I need to add an exception! How can I do this? I currently use RewriteRule ([^.]+).html $1 [R=301,L] to rewrite all .html urls I do need the exception for the google.html verification file. ...
1
vote
2answers
55 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
1answer
122 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 ...
1
vote
2answers
82 views

Lazy Conditional Rule not doing anything! Why?

I am rewriting php generated thumbnails with igly urls into nice ones. instead of img.php?src=bla.jpg&w=200&h=100 the static filenames IMG-file_w200_h100.jpg Because the rewrite is so ...
1
vote
1answer
74 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
262 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/(.*)$ ...
1
vote
1answer
269 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 ...
1
vote
1answer
145 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: ...
1
vote
2answers
83 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 ...
1
vote
2answers
1k views

htaccess with conditional rewritebase

I have a site (the-tack-shop.co.uk) in which I'm testing my e-commerce framework on. I was trying to test payment using a shared SSL: https://web43.secure-secure.co.uk/the-tack-shop.co.uk/. I had to ...
1
vote
2answers
3k views

RewriteCond in .htaccess file gives me bad flag delimiters

I'm upgrading a website and I use this .htaccess file to show maintenance page: #MAINTENANCE-PAGE REDIRECT RewriteEngine on RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.0 # Bogus IP address for posting ...
1
vote
0answers
36 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 ...
1
vote
2answers
139 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
174 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
68 views

mod_rewrite for specific domains in a mappings file

I have a bunch of domains that I want to go to one domain but various parts of that domain. # this is what I currently have RewriteEngine On RewriteCond %{HTTP_HOST} ^.*\.?foo\.com$ [NC] RewriteRule ...
0
votes
3answers
2k 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
40 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
909 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
2answers
122 views

.HTACCESS RewriteRule for 2 Domains

I have two domains, which content is in the same file directory: http://www.alpha.com/ DIR: /var/www/alpha.com/ and http://www.beta.com/ DIR: /var/www/beta.com/ I want to do the following ...
0
votes
1answer
192 views

Compact Redirects in Apache/htaccess. How? [An Elegant Coding Question]

when setting my redirects in htaccess, i have trouble setting/combining various domains when they all go to the same homepage. I can do them separate, but that isn't neat/elegant. How to rewrite the ...
0
votes
1answer
147 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 ...
0
votes
1answer
111 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
88 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 ...
0
votes
1answer
76 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
2answers
264 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
2answers
140 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
235 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
89 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 ...
0
votes
2answers
310 views

Matching more than one Query String with RewriteCond

I have the following configuration in an Apache configuration file for a CGI script: RewriteEngine on RewriteCond %{QUERY_STRING} !^/var/log/syslog-ng/JBoss.*$ RewriteRule ^/cgi-bin/(.*)$ ...
0
votes
2answers
78 views

safe 301 redirection using htaccess for two domains

I have two domains, a new domain (newdomain.com) and and old legacy domain (olddomain.com). I want to safely redirect the old domain to the new domain. Easy enough. At the moment I am doing this ...
0
votes
0answers
14 views

Apache 2.2 rewrite (redirect) [duplicate]

I have a wordpress site that I'm having some issues doing proper redirecting to a new server and new url. Old server: http(s):\\devblog.server1.com New server: http(s):\\new.server2.com/dev/blog ...
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 ...
0
votes
0answers
32 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
18 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 ...
0
votes
1answer
48 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 ...
0
votes
0answers
47 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
0answers
45 views

Redirect to HTTPS and back with .htaccess on specific pages

I'm trying to use rewrite rules to redirect to HTTPS on specific pages, and back to HTTP on all the other pages. The pages that needs to be redirect are those who have the following in the URL: ...
0
votes
1answer
711 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. ...
0
votes
1answer
75 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
1answer
91 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 ^(/)?$ ...
0
votes
1answer
59 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 ...
0
votes
1answer
429 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
296 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 ...