0
votes
1answer
49 views

apache - query string rewrite rule adds percentage symbol

I've set up a rule to rewrite a query string. Although the redirection is correctly performed, a % character is appended to the rewritten query portion of the URL, like so: ...
0
votes
0answers
20 views

redirect robots.txt to alternative apache mod rewrite [duplicate]

I'm having trouble trying to get an alternative robots.txt to display for different host names so that Google or Bing won't spider different addresses. Here's what I have so far #temporary dev rule ...
0
votes
0answers
85 views

How to exclude a URL from mod-rewrite with nginx?

I'm moving my Joomla! 2.5 from Apache Ubuntu to Debian nginx and I need to exclude some URLs from the mod-rewrite. Now I'm rewrite all within this directive on the IspConfig panel: # mod_rewrite url ...
1
vote
1answer
31 views

Rewrite rule when source contains a '?' [duplicate]

Scratching my head on this. I have an old URL: http://myserver/blog/archive?openview&type=Category&key=Demo and a new URL http://myserver/blog/categories/Demo I'm trying to get ...
0
votes
0answers
22 views

Apache 2 rewrite rule expression [duplicate]

I need to make a rewrite rule in an intranet Apache2 (CentOS 6.4) Server. I need to redirect (servername)/(path) to (servername).(domain)/(path) OR (serverIP)/(path) to ...
0
votes
0answers
36 views

mod_rewrite rule should be matching, but isn't [duplicate]

I've only started editing rewrite rules a few days ago, before now I'd copy and paste them for each case. I've written a rule which as far as I can tell*, should be matching but isn't RewriteRule ...
1
vote
1answer
361 views

How to block all incoming proxy visits except from one specific I.P?

I have a page that is prone to attacks, so, in order to reduce the anonymous attacks, I use this code in my .htaccess which I found online : # BLOCK PROXY VISITS <IfModule mod_rewrite.c> ...
1
vote
1answer
53 views

Mod_Rewrite Rule (or an Alternative) For Reorganizing Directory Structure [closed]

The website I work on had these two pages in the past: http://www.africananimals.com/stripes/zebras and http://www.africananimals.com/news/zebras (These are not actual domain names, just ...
0
votes
2answers
781 views

How to combine RewriteRule of index.php and queries rewrite and avoid Server Error 404?

Both RewriteRule's works fine, except when used together. 1.Remove all queries except query ?callback=.*: # /api?callback=foo has no rewrite # /whatever?whatever=foo has 301 redirect ...
1
vote
1answer
362 views

Convert from apache rewrite to nginx

I want to convert from apache rewrite modules to nginx RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR] RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR] RewriteCond ...
0
votes
1answer
183 views

How to match a string in URI with regular expression?

In my Apache config httpd.conf, I wish to setup a rule like below SetEnvIfNoCase %{QUERY_STRING} ^.*(getBook+)$ no-gzip dont-vary I am hoping to do no-gzip when my URL looks like ...
1
vote
3answers
223 views

Apache mod_rewrite, multiple variables

I'm struggling a bit with mod_rewrite and replacing multiple variables with regexes. I'm trying to rewrite the following: www.mysite.com/avatars/funny/1 into: ...
1
vote
1answer
248 views

Apache RewriteCond: inject string into URI between regex match groups

EDIT This works, needed to use % in place of $ for capture groups: RewriteRule (.*) http://localhost:8081/%1/%{TIME_YEAR}1101%2 [P] Having a hard time sorting this out. Need a date string ...
0
votes
0answers
106 views

RewriteMap and RewriteRule troubleshooting on Apache2

First off, I'm trying to get the following rule working: RewriteMap legacyredirect txt:/var/www/path/to/legacyredirect.txt RewriteRule ...
1
vote
1answer
233 views

RewriteRule mp3 to php

I want to rewrite all .mp3 files to a php file. And I dont want to pass on the path so http://localhost/somepath/feb.mp3 http://localhost/feb.mp3 shouldn't do any difference. I came up with: ...
0
votes
0answers
297 views

How can i test for an environment variable in a RewriteCond

Is there a way to put an environment variable in the condPattern part of a RewriteCond? Here is what i tried: RewriteCond %{REQUEST_URI} /%{ENV:ALIAS}/(js|css|img).* RewriteRule (.*) - [L,NS] But ...
0
votes
1answer
202 views

Mod_rewrite excluding files/directories but including .php files

The traditional mod_rewrite for routing is as follows: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [L] ...
0
votes
1answer
193 views

.htaccess ModRewrite when moving web root content into subdirectories?

I'm cleaning up and rearranging the files on my server (basic shared hosting situation) and am digging into .htaccess to do so. I'm moving the content I had in my web root into the subdirectory of ...
1
vote
1answer
454 views

RewriteRule: cannot compile regular expression. Version support?

I'm running an Ubuntu 10.04 LTS, Apache version 2.2.14. On httpd.conf I've a rewrite rule that look like this: RewriteRule (*UTF8)^/users/([^/])([^/]+)/(.*)$ /users/$1/$2/$1$2/$3 [L] The idea ...
0
votes
1answer
1k views

Apache htaccess RewriteRule to remove trailing slash; infinite loop?

I use the following in .htaccess (mod_rewrite) to remove the trailing slash from my URLs: RewriteRule ^([a-z0-9_-]+)/$ $1 [L,NC,R=301] Of course, since the character class doesn't match a slash, ...
0
votes
2answers
441 views

need to redirect to static url based off of string patter match in uri

I have siteminder protecting an Oracle ADF java faces app. It appears I am going to have to intercept an http reqeust for the logout link delivered by Oracle in order to kill the siteminder session. ...
0
votes
2answers
108 views

Optimal mod_rewrite regex. Does the way the matching patterns are arranged inside the regex matter?

I have the following: RewriteRule ([a-zA-Z0-9]{5})?/load_page/([0-9]+) Which arrangement would be optimal for the regex: RewriteRule ^/([a-zA-Z0-9]{5})?/load_page/([0-9]+) OR RewriteRule ...
0
votes
1answer
47 views

Help with simple mod_rewrite needed

My site uses mod_rewrite for most URL's within the site. eg. domain.com/contact.htm domain.com/product/details.htm I've had domain.com/contact.htm working for a long time and is quite simple, but ...
2
votes
2answers
385 views

apache question mark RewriteRule question

So i am trying to redirect from index.php?action=search&query=search text goes here to search?query=search text goes here i tried this so far but with no luck RewriteRule ^search/? ...
1
vote
1answer
171 views

htaccess for wildcard subdomains

How to translate the example URL to the needed one? From http://test.at.domain.com To http://domain.com/at/index.php?at=test I have: RewriteEngine on RewriteCond %{HTTP_HOST} ...
4
votes
2answers
222 views

Why does a $1 backreference work in a rewrite with no subgroups?

Someone I'm working with committed a RewriteRule such as the following to SVN: RewriteRule ^admin/ebay.*$ /yii.php/$1 [L] I warned him that it may not work because there is no subgroup in the match ...
2
votes
2answers
300 views

URL rewrite on custom Wordpress site

I've been tasked with modifying an existing Wordpress site with URL rewriting. Problem is I've never done this before. I know these rules should go in a .htaccess file in root with something like this ...
1
vote
2answers
287 views

Why do two patterns (/.*) and (.*) match different strings?

Shouldn't the two patterns (/.*) and (.*) match the same string? My real question is actually: where did the "abc" go? Something funky seems to be happening inside the mod_rewrite engine... Given ...
0
votes
1answer
389 views

(\d+) and ([0-9]+) htaccess rewrite not working on new server, works fine on old server

RewriteRule ^mp3/(\d+)/(.*)/$ download.php?id=$1 [L,NC] is the specific rewrite rule I am trying to get working....it was working fine on my old server but now I am on a server with Apache 1.3.4.1 ...
1
vote
2answers
280 views

mod_rewrite rule

I need a mod_rewrite rule that sends all requests to index.php unless the request is for anything in the /media/ folder. I have a similar rule for lighttpd but I don't know enough about ...
2
votes
2answers
118 views

Make shortened and long urls play together on the same domain (RewriteRule)

Long story short, I want to have both example.com/aJ5 and example.com/any-other-url working together. I'm using apache and not very good at writing regex. I have already a global RewriteRule which ...
0
votes
1answer
122 views

Need a Mod rewrite regex solution for .htaccess

I moved my site to different server since then my all urls started showing up 404 error. earlier my all urls were like this mysite.com/title-of-url but now all such urls are getting 404 error, so i ...
1
vote
1answer
588 views

mod_rewrite rule for images with query string

I'm a mod_rewrite novice and a regex noob, but here's what I want to do: I've got a script that will re-size images on the fly. I'd like to be able to take any image file path, add a query string to ...
2
votes
1answer
962 views

how to use a rewrite rule to test the date in a cookie?

I found out that you cannot use a RewriteCond backreference as a pattern condition in the next Rewrite Cond... UPDATE: As it turns out, mod_rewrite doesn't expand any variables in the test pattern, ...
2
votes
2answers
2k views

Regex negative look-ahead is not working for mod_rewrite between different Apache versions

I have a mod_rewrite line that works under Apache 2.2, but not under Apache 1.3: RewriteRule ^(?!index.php)(?!skin/)(?!js/)(.+) /index.php?file=$1 [NC,L] If I lose the ...
1
vote
1answer
39 views

Help with mod_rewite rule

I have a rule that will get the extension of every file from the url. I need to match all jpg, gif, png and bmp files. This is for a watermark application. Currently, it only matches jpg and Jpg. Can ...
0
votes
4answers
164 views

mod rewrite regex

The plan is to take domain.com/chat2/roomnumber and redirect to domain.com/chat2/index.php?room_id=roomnumber. Here's my code that's NOT workin: RewriteEngine on RewriteRule ...
0
votes
2answers
121 views

Mod_Rewrite recipe

I need to accomplish the following with mod_rewrite: URI request: http://domain.com/user/username/ or http://domain.com/user/username URI translate: http://domain.com/?q=user/username This needs to ...
0
votes
2answers
281 views

ModRewrite 9 Back Reference Limit

This is a complicated one which I hope has a simple answer... RewriteRule ^category/([^.]+)/([0-9]+)/([^.]+)/([0-9]+) category.php?c_id=$2&filters=$3&_p=$4&name=$1 This rule would pick ...
1
vote
2answers
2k views

Apache mod_rewrite, using current URL in RewriteCond

I have several RewriteRules in an Apache VirtualHost configuration. I'd like to be able to test the current URL (after the preceeding rewrites) against some condition. The problem is that the ...