mod-rewrite

use RewriteMap in htaccess file

How can i use RewriteMap directive in htaccess file? When i put it there i get "RewriteMap not allowed here" error. I know this error will disappear when put it in httpd.conf or virtualhost configuration file. But i want to know is it possible to put it in htaccess or not? ...

Regex working in testing program but not in .htaccess

I'm trying to redirect a URL that looks like 'accommodation/destination.php?code=108459&destination=Yang+Chum+Noi' The regex I'm using: (^accommodation/destination\.php\?code=([0-9]+)&destination=([^/]+)$) ...works fine in my regex tester but when I use it in the .htaccess file it doesn't work. Am I missing something here? ...

Why doesn't my custom RewriteMap program return the expected results?

I want to redirect some urls with id = n to id = n + 1000 (where n is a variable). After searching on the internet I found out that I can do this using a prg type RewriteMap directive. However, I ran into some trouble getting it to work. The code I am using to test using a custom RewriteMap is included below. This is my test.pl file th...

.htaccess for multiple application in Kohana V3

Hi I have setup multiple application in Kohana v3, it works normally without enabling .htaccess (to remove index.php or admin.php) my setup + system/ + modules/ + applications/ + public/ + bootstrap.php + ... + admin/ + bootstrap.php + ... + index.php (for 'public' application) + admin.php (for 'admin' application)...

Find out which Zend Framework module loads CPU up to 200%

In my Cpanel account in Daily Process Log I can see that my zend framework application load CPU very much Top Process %CPU 182 /usr/bin/php /home/*******/public_html/index.php But any requests to ZF application goes by index.php (with rewrite rule for Apache) Is it possible to find out what request (url) load CPU? ...

mod_rewriting fun with two .htaccess files...one for wordpress and one for CI in a subdirectory

I have a weird situation that's come up, so I'm hoping some one can help me out. I have a wordpress installation in the root directory and a codeigniter installation in a subdirectory (I know, I know...). Both are working fine on their own. The codeigniter installation has its own .htaccess file for rewriting to index.php. But what if ...

rewrite php file in htaccess with our without query string

So I have photographs.php, and there are also sections where it will be rewritten as photographs.php?cat=somecategory Question is, in .htaccess how do I get these both to work as such /photographs and /photographs/somecategory so that the $_GET['cat'] variable will be = somecategory ...

htaccess rewrite base url

Anyone out there good with htaccess and mod rewrite - i need your help! I need to rewrite the base part of a url. for example all requestst to http://domain1.com need to go to http://domain2.com The requests will typically be in the form as follows: http://domain1.com/main/test?q=1 i then need to go to http://domain2.com/main/test?q...

Use htaccess to mask folder name

Here's a problem I'm always wanting to solve with htaccess. I haven't found a way yet, though it looks like it should be possible - perhaps someone can help. Let's say I have a folder at the root of my site called /foo/. I want users to be able to access that folder at the path /bar/, but for various reasons I can't rename the folder. ...

htaccess redirect 301 all to one domain

I have 3 domains: domain1.com domain2.com domain3.com I want to 301 redirect all to domain3.com/$1. That includes domains with www and non-www. domain1.com -> domain3.com www.domain1.com/$1 -> domain3.com/$1 domain2.com -> domain3.com www.domain2.com/$1 -> domain3.com/$1 domain3.com X-> domain3.com (no redirect) www.domain3.com/$1 -...

Wordpress and Drupal on the same domain cause htaccess conflicts?

Have a client who wants to move their Wordpress.com blog over to their main domain that has a Drupal installation. If I add Wordpress to a "/blog/" directory on the server, will there be any conflicts with the htaccess ie Mod Rewrites etc? Thanks. ...

How can I turn off QSA? (query string append)

I'm using Apache2 and mod_rewrite to hide my query strings. These are the rules in question. RewriteCond %{QUERY_STRING} ^query=(.*)$ RewriteRule (.*) /search/%1 [R=301,L] RewriteRule ^search\/?$ /search/?query=test [R=301,L] When I visit /search (or /searc...

How to NOT match a word in mod_rewrite

Please help, I'm going crazy! RewriteRule ^([a-z0-9_-]+)?/?search/?$ search.php?id=$1&%{QUERY_STRING} [NC,L] This is my current code. Sometimes people will visit mysite.com/search, other times they will visit mysite.com/boris/search and I detect a user with an empty($_GET['id']) check. However I am creating another search, mysite.com...

apache rewrite map redirect to 404

My Situation: I implemented an apache Rewrite Map to redirect incoming requests based on a database RewriteEngine On RewriteMap dbapp prg:/usr/local/somewhere/dbapp.rb RewriteRule ^/(pattern)$ ${dbapp:$1} [R] So far everything works fine, but I want to decide in the dbapp.rb script weather to redirect or give the client a http-sta...

Mod rewrite user URL

Hi I'm lost here. I'm using this script to give users the opportunity to enter their username lijke this:domain/username <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/?$ userpage.php?user=$1 [NC,L] </IfModule> Th...

Mod_rewrite help

Hey guys, I'm trying to remove query strings from my calendar, but my mod_rewrite is not appending the query string. The website is http://cacrochester.com/Calendar and if you click the link to go to a different month, the query string is usually http://cacrochester.com/Calendar?currentmonth=2010-11 With my rule below, it just doesn't...

Managed Fusion Url Rewriter - how to install, get basics working

I'd like to try this out, downloaded it , read the readme, referenced the dll, edited the web.config. I couldn't find any documentation besides the readme, and it seems that there is a lot to know to get it to work...so, I've been kind of grasping in the dark. I set-up a txt file, didn't know where to put it so dropped it in both the...

Accessing the rewritten URI in a php script

So I have a .htaccess file which is performing a rewrite from /testscript1.php/testvar1/testvar2 to /testscript2.php/testvar3/testvar4 (this is an over simplification but you get the idea). Now though in my testscript2.php script when i access the $_SERVER['REQUEST_URI'] variable i see /testscript1.php/testvar1/testvar2 rather than /t...

mod_rewrite different URIs to one location

Hi guys, I'm struggling with probably quite simple mod_rewrite taks. This is the directory structure I have: root\ translations\ en\ (contains various subfolders with files, 2 levels deep) fr\ (contains various subfolders with files, 2 levels deep) what I want to do is to point various dynamically created URLS to those specific...

apache redirecting with 301, instead of internal rewrite

I'm trying to map/mask a subfolder to a different folder on the same server. I've done it plenty of times before but I can't get this to work properly. I want the user who accesses directory "a" to see "oldsite/a" instead, but I do NOT want them to be redirected, or to see the new address in the browser. <IfModule mod_rewrite.c> ...