mod-rewrite

Do HTTP authentication over HTTPS with URL rewriting.

I am trying to protect the ~/public_html/dev directory using http auth basic, but to make that secure I want to run it over ssl. The middle section of the below .htaccess file switches to https if the request URI begins with /dev and works. The last section of the file works as well but does not work properly with the https redirect. ...

Rewrite URL to HTML file causing rewrite to .html/

I'm currently working on an overhaul of my blog site, and have found a way to convert all my current pages into static html pages. They are currently using friendly url's which remap to a central index.php page with GET parameters attached on. The change I am trying to make is have those same friendly URL's map to their html counterpart...

mod rewrite with a lot of parameters

Hi, I am trying to find a mod rewrite solution to my problem. I have almost 6 parameters that i am passing to my url and i want to rewrite. Let me demonstrate an example of 3 parameters (x,y,z) The url is list.php?x=1&y=2&z=3 so a rule will be RewriteRule ^list/x/([^/\.]+)/y/([^/\.]+)/z/([^/\.]+)/?$ list.php?x=$1&y=$2&z=$3 So far...

How to simulate [L] in .htaccess

I have a .htaccess file with a number of RewriteRules. How can I exclude already existing files and directories from having run through each of the RewriteCond / RewriteRule pairs? This: RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_FILENAME} -d RewriteRule .* - [F,L] won't work reliably because according to this SO q...

Using MOD Rewrite to rewrite user requests only

Hi I use this: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?action=$1 [QSA,L] Which works as it is supposed to (makes www.example.com/something redirect to : index.php?action=something). I want to save each request in a DB.So if i insert the $_GET['action'] vari...

modrewrite or php rewrite for language subdirectories

i want an .htaccess rewrite so /en/home pulls /home /es/stuff.php pulls /stuff.php /fr/something/thisis.php pulls /something/thisis.php without it being visible in the url. ...

.htaccess mod_rewrite has different result on different sites

Hi, I am using mod_rewrite to create SEO URLs. Basically the thing works in the following way: all requests are caught by .htaccess and redirected to a php script (let's say transform.php). transform.php parses SEO URL and transforms it into a normal URL, then includes index.php, then catches application's (index.php's) output and uses ...

mod_rewrite rule to use the CSS from root web folder in a subdomain

My root already has all the css and image files I require www.example.com (my domain) www.example.com/css/style.css (my styles) On my hosting, my sub domain has to live inside a folder root folder public_html/ index.php css/ style.php subdomains/ admin/ .htaccess index.php How can I use mod...

joomla .htaccess file rewrite rule explanation required

Hi, I'm trying to understand the following lines in joomla's .htaccess file. Can someone explain this please #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteCond %{REQUEST_URI} !^/index.php #RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC] #RewriteRule (.*) index.php ...

htaccess help needed

hello to all, i'm doing maintenance work on a cms and have found the following htaccess file: <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On #RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] i'm having trouble understanding it. the reason a...

mod_rewrite with subdomain and url pattern

Hi everyone, I want to use the subdomain as a get variable with mod_rewrite AND use some parameter : eg /page/language/site/counter -> index.php?o=operator&lg=language&s=arg1&c=arg2 How to do that with mod_rewrite? RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteCond %{HTTP_HOST} ^([a-zA-Z]{3,6})\.example...

Modrewrite regex

I have the following URL: http://www.domain.com/keyword/b21?f=&amp;ca1=50&amp;p=1 And the RewriteRule I am trying to use is as follows: RewriteRule ^([^.]+)/b([0-9]+)?f=([^.]+)&p=([0-9]+)$ script.php?id=$2&p=$2&filters=$3 Unfortunately this rule is not matching the URL. I think it has something to do with the ? as i know this is a c...

htaccess not working as it should

well, ofcourse its not working, im still a n00b :) this is the code that i have : Options +FollowSymLinks RewriteEngine on RewriteRule (.*)\.css - [S=7] RewriteRule (.*)\.jpg - [S=6] RewriteRule ^gallery gallery.html [L] RewriteRule (.*)/(.*)/ index.html?page=$2 [L] RewriteRule (.*)/(.*) index.html?page=$2 [L] RewriteRule (.*)/ index....

mod rewrite issue

How come this one works: RewriteEngine On RewriteCond %{REQUEST_URI} ^/book/blabla$ RewriteRule ^.+$ /book/?name=blabla [NC,L] But this one doesn't? RewriteEngine On RewriteRule ^/book/blabla$ /book/?name=blabla [NC,L] I've tried many things but it's confusing me. ...

Simple mod_rewrite and website dir structure

I am making a site with photo albums for agents. Each agent has his folder with .css file. Each agent dir has album folders with index.php and .css /example.com/ /agent001/ agent001.css /000005/ index.php main.css /photos/ aaa.jpg bbb.jpg /000006/ index.php ...

.htaccess rewrite rule for redirects

I've been fighting this for a while and can't seem to make it work. My old system used a lot of query strings to render pages but they are no longer necessary. My url is below: OLD URL: www.example.com/links.php?section=5&catid=52 NEW URL: www.example.com/mhfs/links The name links is coincidental and not necessarily from the old pa...

rewrite url not working on ubuntu localhost in php

I have the file called call_center_interface.php Options +FollowSymLinks RewriteEngine on RewriteRule call_center_interface-act-(.*)\.htm$ call_center_interface.php?act=$1 i use the above url rewrite code but it is not working in ubuntu ...

.htaccess port redirection with Apache

Hi, I'd like to redirect http://www.mydomain.com/service to http://www.mydomain.com:PORT where PORT is the port of the service which will serve the pages. Is it possible given it's apache which is listening on port 80 so which will perform the redirection, and it's an unrelated service which is listening on PORT? What's the syntax? I ...

numeric RewriteRule with .htaccess

I would like to send URL requests to a PHP script which will handle the 301. The URI's I want to capture are dates, like 26-11-2010, without the dashes: www.mysite.com/261110/ (6 digits) What is the RewriteRule for this? my script is www.mysite.com/redirect.php?data=261110 ...

RewriteCond match for certain parameter values, part 2

Before I begin, let me just say that I know my question is almost identical to this one. The difference is that, while I am trying to use a RewriteCond to identify a specific parameter in the query and redirect appropriately, I do not want the query string appended to the resulting URL. Here's what I'm trying to do in my .htaccess file...