mod-rewrite

Applying mod_rewrite rules AFTER DirectoryIndex is applied

Hi there, My hosting company recently upgraded me from Apache 1 to Apache 2, and I've started seeing some quite different behaviour with my mod_rewrite stuff. Here's my .htaccess file: DirectoryIndex blog.html # Various rewrite rules. <IfModule mod_rewrite.c> RewriteEngine on # Rewrite current-style URLs of the form 'showpage.ph...

Removing trailing slashes with mod rewrite?

This relates to my previous question (which can be viewed here). I'd like to be able to remove the trailing slash from the URL so that it doesn't mess up certain areas of my site. The .htaccess code is here: # -s = File Exists RewriteCond %{REQUEST_FILENAME} -s [OR] # -l = Is a SymLink RewriteCond %{REQUEST_FILENAME} -l [OR] # -d = Is a...

How can I make new site visitors see the splash page through mod_rewrite?

Basically, my client wants to make new visitors enter the site I'm working on through the splash page. Unfortunately, Google indexed the home page. So no one ever actually sees the splash page. Is there a way that I can make a .htaccess file create a cookie in the viewers browser that says "I'm not new" (or maybe showsplash=false). Then ...

.htaccess RewriteRule apache: how to rewrite based on URL parameter?

I have URLs with lots of parameters, here is an example that looks like this: http://www.mysite.com/profile?reset=1&amp;force=1&amp;gid=9&amp;custom%5F18=BS+Forestry%2C+University+of+Kentucky I would like to do a RewriteRule that redirects any request containing the string: &custom To a static HTML page such as: http://www.mysit...

mod_rewrite redirect to URL with propietary protocol

I'm using Apache 2.2 with mod_rewrite. Is there a way to force mod_rewrite to rewrite the entire URL, including protocol? I know it will automatically rewrite the whole URL if the redirect contains http:// at the beginning but I'm trying to redirect to a URL that uses a proprietary protocol: fcp:// When I add it in as the redirect it j...

UrlRewriteFilter equivalent for mod_rewrite

Hi gentlemen I want to do Url rewrite in Tomcat using UrlRewriteFilter This is the rule would like in mod_rewrite apache RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php/$1 [L] I'm confused in how to check the request filename if it's not a file or not a folder in UrlRewri...

.htaccess, mod_rewrite and subdirectories

Concerning the .htaccess documenation, putting a .htaccess file in a directory should affect this directory and all subdirectories. But I have problems getting this to work: I have to files, alice.html and bob.html (just printing "Alice" and "Bob"), and this .htaccess in the same directory (/tmp/rewrite): RewriteEngine on RewriteBase /...

apache2 force proxy for specific url on a subdomain

Hi, I have a site that has dynamic virtual subdomains using mod_rewrite, as defined like this: <VirtualHost *:80> ServerName example.com ServerAlias *.example.com DocumentRoot /var/www/example.com/www RewriteEngine on RewriteCond %{HTTP_HOST} ^[^.]+\.examle.com$ RewriteRule ^(.+) ...

Should I set rewrite rules on an ASP.Net MVC site with heliontech IISRewriter Globally or by folder with wordpress?

I'm using IIS6 (unfortunatly) and have built an ASP.Net MVC app; IIS is set up for wildcards to make the routing work but I have two virtual directories that contain wordpress installations which works fine. I have two .htaccess files (one in each wp install) that handles their rewriting fine, but I want to setup a rewrite from /about t...

ModRewrite Split Issue

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 up category/kitchen/10/0-0-0-0-0-0-0-0/1 with the following get vals: category.php?c_id=10&filters=0-0-0-0-0-0-0-0&_p=1&name=kitchen The reason fil...

Having problems with a Rewrite rule.

Hi, I have an application most of it is still in development that's why i need to block access on all pages but just not two of them. Suppose i have a.php all requests will be redirected to here except b.php. So i think there should be 3 rules: 1st: when a.php and b.php are requested they should be visible to user, 2nd: if anything ...

mod_rewrite redirect all urls except /wiki

I'm new to mod_rewrite and have just been going by trial and error so far, I'd like to redirect all URL requests to /drupal-6.13/ and hide the /drupal-6.13/, but if the URL is www.site.com/wiki not to rewrite anything. I'm also using the pathauto mod in drupal to create /content/title links for story content. I think it's the last sectio...

mod_Rewrite: Filter specific pages by IP and redirect them

Hi All, I am researching a way to work filtering specific pages by IP and redirect them on a different page. The code below, did not work properly. RewriteCond %{REMOTE_ADDR} ^/192.168.10.* RewriteCond %{REQUEST_URI} ^/support RewriteRule ^/.* http://www.yahoo.com/gone [R,NE] Once the link http://example.com/support has been accesse...

Apache returns sitemap.xml not /sitemap

First, this problem is on my local testing site; the live site is okay. I have a site where there is a link to blah.com/sitemap. In the DocRoot there is a file called sitemap.xml, which I don't want to display in response to that link. There is a rewrite rule in /.htaccess: RewriteRule "^([a-z]{1}[\w_\-]+[a-z]{1})$" "/index.php?action=...

mod_Rewrite: Allow only one IP and redirect the rest to a certain error url?

I got a code that will match a certain block of IP and redirect them to another page. RewriteCond %{REMOTE_ADDR} ^192\.168\.10\..* RewriteRule ^/support http://www.yahoo.com/gone [R,NE,NC] However, how would I reverse this? to only allow one IP and redirect the rest to a certain url? ...

mod_rewrite - splitting up arbitary number of terms?

heya, I'm attempting to write a mod_rewrite rule to remap some friendly URLs for searches, and my regex-fu isn't that good...lol. Basically, in the URL, after the subdomain, there will be a variable number of words (\w), separated by a character (say +). An empty expression is allowed (i.e. "foo.bar.com"), and then after that, somethin...

mod_rewrite: Redirect if anything but a file

I have an Apache .htaccess file in the parent directory to directory this .htaccess file is currently located. This works perfectly redirecting all requests as required. However, I would like it so in this directory, if the request is for a valid file (and NOT a directory), ignore the main rewrite rule. Currently, the following turns of...

redirect problem "No input file specified"

Hello! I'm working on a url shortner script. It's located at http://mini.ample.se/ and the short URL will look something like http://mini.ample.se/%5Babc..%5D my .httaccess file looks like this <IfModule mod_rewrite.c> RewriteEngine on RewriteOptions MaxRedirects=1 RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f Rewr...

htaccess question

This is a simple htaccess question for experts but I have been trying to get this sorted for a while. This was something a developer did before my time with this code. He truncated the image file extension from the requests. As an example, /images/btn/Find a bear should get the URL changed internally to /images/btn/Find a bear.gif All ...

mod_rewrite issues

I have used the mod_rewrite module but was not able to redirect to the target page - I am getting an error: The requested URL /old.html was not found on this server. Rewrite rules as follows: RewriteEngine On RewriteRule ^/IN/index.html$ /IN/index.iface [L] ...