mod-rewrite

Isapi Rewrite - preserving HTTPS in redirects behind load balancer

Hi, I'm running a site which has 2 separate sub-domains - one for HTTP and another for HTTPS. http://www.example.com https://secure.example.com http://secure.example.com does not exist and will not resolve. The problem is that the site is running behind a load balancer which handles all SSL. Communication between the load balancer ...

.htaccess while upgrading web app

I am writing one web application using PHP/CodeIginter. Now, I want to add a .htaccess while I am upgrading the application in the server. The purpose of this .htaccess will be: - It'll allow normal operation if the user is accessing from some specific IPs, and Using a particular host name alias has a query string parameter "upgradi...

How can I append HTTP_REFERER to query string using htaccess?

In my .htaccess file I have a set of rules as follows: RewriteRule ^dir/page1$ /bleh/docs/?id=12 [L,QSA] RewriteRule ^dir/page2$ /bleh/docs/?id=13 [L,QSA] RewriteRule ^dir/page3$ /bleh/docs/?id=14 [L,QSA] Sometimes one of these rules may be accessed via a redirect from another site (referer). I would like to be able to append the refe...

Common Rewrite Setting For Multiple VHosts

Hey, I am running Apache2 with multiple vhosts in the sites-enabled folder, each looks a bit like this: <VirtualHost *:80> ServerName site1.com ServerAlias www.site1.com DocumentRoot /home/sites/site1/www/ <Directory /home/sites/site/www/> Options Indexes FollowSymLinks MultiViews AllowOverride all ...

Mod_Rewrite: Insert "/" between variables and values in URL

Hello all, I am attempting clean useful URLs using mod_rewrite. I am sure this is a common question but I am not so hot with mod_rewrite: I have this URL: http://mysite.com/user.php?user=fatcatmat&amp;sort=popularv I want to be able to rewrite it like this: http://mysite.com/user/user/fatcatmat/sort/popularv (Is there a way to remov...

PHP and htaccess redirection: Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz

Hi, let's say I want to use .htaccess to rewrite the following. Rewriting /user.php?username=xyz to /xyz. I would use: RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1 The problem is once this is done, how do I access the username in my other links? so /mike/d...

How to remove part of a URL using .htaccess

Hi, I have a url like this. /domains/details.php (NOTE: domains is dynamic and can be anything) How do I remove the domains part from the URL using .htaccess so the actual lookup is: /details.php OR it'll be cool if I can get domains into the URL. /details.php?page=domains Thanks! Scott ...

Rewrite Url with apache2

Hi, I'm experimenting with CodeIgniter PHP framework, this framework works like: http://localhost:7777/~dhalsim/ci/index.php/blog So, I tried to remove index.php part from there. So far I do these: make $config['index_page'] = "index.php"; to $config['index_page'] = ""; make $config['uri_protocol'] = "REQUEST_URI"; from $config['uri_...

Helicon Isapi rewrite - can't get urls to be case insensitive

Running Helicon Isapi rewrite to make overly long coldfusion CMS generated urls 'friendly'. Works very well and we've been using it for several years both with direct rewrites and regex. I cannot get it to treat urls case insensitively. The following rule is an example: RewriteRule /scriptcontent/h1n1/h1n1submission.cfm\?section=Human...

Url Rewrite issue in IIS MOD REWRITE

Hi, I have a below code in mod-rewrite.txt RewriteEngine On RewriteRule /\.htaccess$ - [F] RewriteCond %{HTTP_HOST} !www\.espireinfo\.com$ RewriteRule ^(.*)$ http://www\.espireinfo\.com$1 [R=301,L] RewriteRule ^/schools/index.aspx$ /schools/english-language.aspx [R=301,L] RewriteRule ^/about/Contact.aspx$ /about/contact.aspx [R=3...

mod_rewrite redirects screw up paths

Here's a redirect I have: RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1 The problem is if I type http://www.example.com/apple it's OK when it comes to my links on the page. BUT if I use http://www.example.com/apple/ (notice last slash) then links are all scre...

Mod Rewrite - htaccess

Menu code: <a href="/category/<?=$cat_name['id']?>/<?=simpleURI($cat_name['catname'])?>/" title="<?=ucfirst($cat_name['catname']); ?>">Level 1</a> <a href="/category/<?=$subcat_name['id']?>/<?=simpleURI($cat_name['catname'])?>/<?=simpleURI($subcat_name['catname'])?>/" title="<?=ucfirst($subcat_name['catname']); ?>">Level 2</a> <a href...

Redirect non-www URL to www URL in conjunction with other rules

Redirecting a visitor who hits http://example.com to http://www.example.com isn't terribly difficult. But how is it done in conjunction with a RewriteRule that directs all page requests through "index.php"? RewriteRule !\.(gif|jpg|png|css|js|php|ico|xml)$ /index.php ...

Pass parameter to wordpress plugin with pretty url, mod_rewrite, .htaccess

Hi, I told wordpress that I wanted urls to look like: domain.com/postname.html I want to pass a parameter to a wordpress plugin. So when I get domain.com/postname.html.2 it is suppose to be domain.com/postname.html?tubepress_page=2 With the following the parameter is passed correctly, but not the name. This is the .htaccess file: <I...

Help with 301 redirects on outgoing links from my site

I work for company that links out to partners through a third party website that tracks them. So for example on our site there will be an outgoing link something like this (names changed to protect my work): <a href="link.php?link=chuckecheese">check it out kids!</a> if you go into link.php, you see I define the link there: $outlink...

How to use reverse proxy to redirect all url's not on my site to the web

I'm thinking of using an apache reverse proxy and an SSL certificate to secure surfing by various laptops roaming about in wireless land. My thought was have the users set this https proxy as their proxy in their web browsers, but I haven't found a way of redirecting them immediately to pages on external websites like http://www.msdn.mi...

.htaccess mod_rewrite redirection between domains

I have two domains, cshen.ca and cshen.net, both point to the same place. I'm trying to accomplish the following with mod_rewrite: cshen.net is 301 redirected to cshen.ca www.cshen.net or www.cshen.ca are both redirected to cshen.ca the path after the domain is preserved after being redirected, for example www.cshen.net/foo/bar/ would...

Mod rewrite most requests to index.php

Options +FollowSymlinks RewriteEngine On RewriteBase / ##RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !\.(js|ico|gif|jpg|png|css)$ [NC] RewriteCond %{REQUEST_FILENAME} !^index.php [NC] RewriteCond %{REQUEST_FILENAME} !^$ [NC] RewriteCond %{REQUEST_FILENAME} !-d ## RewriteRule ^/([a-zA-Z_+-]+).php$ index.php?p=%1...

Help with htaccess redirect rewrite rule

I want to use Helicon ISAPI Rewrite to redirect an old URL to a new URL, but only within a virtual directory named colors: http://www.mydomain.com/colors/default.aspx?id=blue needs to redirect to http://www.newdomain.org/colors/default.aspx?id=blue I am new to this and cannot find an appropriate example, so any help would be appreci...

mod_rewrite problem

I have this rewrite rule to access profile.php?user=username with mysite.com/username.. Problem with this is that it ignores my css, even if I use the full URL and whats weird is that its the same if i go to the regular url, profile.php?user=username. But If i remove my htaccess file the css works. RewriteEngine on RewriteRule (.*) pro...