mod-rewrite

Mod Rewrite: How do you rewrite out of the URL's home directory?

I have a directory structure on our VPS like this: /www /site_one /site_two And going to www.siteone.com brings you to /www/site_one/ on the server. I'd like to use mod_rewrite to point a request for www.siteone.com/thing/ to the directory /www/site_two/thing. I've tried a basic rewrite like: RewriteRule ^page.html$ /www/site_tw...

Rewrite Periods/Dots/(.) in mod_rewrite to plus (+)

How do I change a period/dot (.) into a plus (+) of a match using mod_rewrite? My match is #2. This is my rule so far: RewriteRule ^(.*)/(.*)-[0-9]*\.shtml$ http://kentwired.com/search/most-popular/?searchphrase=exact&searchword=$2 [L,R=301] With my rules currently, http://media.www.kentnewsnet.com/media/storage/paper867/news/20...

URL rewriting that visibly rewrites (changes the URL in the address bar)

I asked sort of the complement of this question before: http://stackoverflow.com/questions/1685030/modrewrite-invisibly Now I actually want a rewrite to happen visibly, because I've switched URL schemes and although I want the old links to work, I want the user to see the new URL scheme. So this works RewriteRule ^oldscheme/(.*)/?$ ...

HTAccess - Confusing clean url's

Hey, If i wanted to simply redirect /clients/page/ to /clients.php?view=page i would use something as simple as this, it works great. Options +FollowSymlinks RewriteEngine on RewriteRule ^clients/([^/]+) /clients.php?section=$1&$2 [NC] If i had for example, a url like: /clients/page/?name=Tom how could i transfer those HTTP GET varia...

mod_rewrite ignores [L]

I want to be able to rewrite this http://localhost/.../identicon/f528764d624db129b32c21fbca0cb8d6.png to http://localhost/.../identicon.php?hash=f528764d624db129b32c21fbca0cb8d6 so I add to the /.../.htaccess so this is it: RewriteEngine On RewriteRule ^resource/ - [L] RewriteRule ^identicon/(.+)\.png$ identicon.php?hash=$1 [QSA,...

Infinite loop on combination of RewriteRules

So I'm setting up SVN on my home server (Ubuntu 9.1), and want the ability to view any changes made to my CodeIgniter app immediately. So, my working copy lives in /home/myname/environments/development/appname. My Vhost is accessible at dev.appname.myname.ca, and the config looks like this: DocumentRoot /home/myname/environments/deve...

.htaccess RewriteRule Problem

this rewriterule only rewrite level.php and when try localhost/a/b/115-aaa.html send all requests to level.php but localhost/a/b/ is work why ? RewriteEngine On RewriteRule ^(.*)\/(.*)-(.*).html$ page.php?page=$1&a=$2&b=$3 [QSA] RewriteRule ^(.*)$ level.php?q=$1 [QSA] ...

.htaccess SSL on certain pages

Basically I'm using drupal and can current redirect to an SSL page. But once on that page and continuing navigation all the pages continue over HTTPS. There is a single page I need SSL on and I need to redirect back after you leave that page. Currently I have this: RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^conference https://url/c...

Rewrite rule fails to match single quote chars

I asked this question earlier: http://stackoverflow.com/questions/1500981/modrewrite-match-only-if-no-previous-rules-have-matched And have been using the suggested solution with success for a while now: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{THE_REQUEST} ^.+\ (/[^?\s]*)\??([^\s]*) Rewrite...

use htaccess to add www with https support

There are a lot of code examples for using .htaccess to add www to a url but they are usually confined to using http. does anybody have an example of how to get it to work in both cases? ...

Apache fast cgi mod_rewrite : no input file

/index/ to /index.php /index/hello to /index.php/hello The site is use path_info, and the default rule not works: RewriteRule ^([^/]+)/(.*)$ $1.php/$2 [L] I change to: RewriteRule ^([^/.]+)((/[^/]+)*)/?$ $1.php$2 [L] That was strange */index/ to /index.php works fine /index/hello to /index.php/hello not work And it sa...

.htaccess mod-rewrite question

hey there, i have quite some issues with the mode rewrite here is what i use : RewriteEngine On RewriteRule ^([^/]*)/([^/]*)$ /creatii.php?creatie_thumb=$2&user=$1 [L] RewriteRule ^([^/]*)/$ /creatiiuser.php?user=$1 i would like this link : http://creatii.artcrew.ro/creatii.php?creatie_thumb=creatie19&user=dee-dee to look: l...

posting data to a web page,need an alternative

To request some data from a web server, we can use the GET method,like www.example.com/?id=xyz but I want to request the data like www.example.com/xyz How can it be achieved in PHP? ...

mod_rewrite: what does this RewriteRule do?

Given these conditions (I know what they mean/do): RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d What does the first rule do? What is that lonely dash for? RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ /index.php [NC,L] I've been using this for quite some time now i...

Mod Rewrite : Replace all _ (underscore) with - (hyphen)

I need to have all _ (underscores) in every url to be replaced with - (hyphens) I currently do it this way, but am looking for a more simpler way of doing this so I do not have to add a line every time a url gets longer. RewriteRule ^([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^_]+)-([^.]+)-([^.]+)-([^.]+)-([^.]+)$ index.php?/$1_$2_$3_$4...

.htaccess rewriterule redirect to a page in a subfolder as long as the real page nonexistant

FTR, this is most definitely a programmer shortcoming. The problem is that I've got a short url rewriterule on that works fine. I can do www.mysite.com/matt and it'll hit my php page that queries for a result. But what I NEED is to do mysite.com/music/matt When I use the same rule for a subfolder as I did on the root dir, it throws a 5...

htaccess/mod_rewrite doesn't work.

I have tried this but it doesn't seem to work: RewriteCond %{QUERY_STRING} ^?var=10&view=3$ RewriteRule ^/index.php$ http://www.domain.com/index.php?var=11&view=1 [L,R=301] ...

cfajaxproxy with url rewriting

Hi, I've been able to successfully implement the cfajaxproxy tag where the cfc in question is located in the root directory of my site. When a page that is IN the root directory of the site, but is accessed by a rewritten url (eg mysite.com/one/two/ -> mysite.com/two.cfm), the javascript generated by cfajaxproxy does not point toward ...

How can I convince mod_rewrite to stay away from my Subversion repositories?

I have a site [hosted on DreamHost], using WordPress for the main content, but Subversion repositories in http://mysite/svn . My file layout is: webroot/ blog # wordrpress files .htaccess My SVN repositories lay outside the web root, but they are correctly mapped to /svn/repository URLs. When I put the WordPress permalink rewr...

Apache mod_rewrite: redirecting subdomains to the HTTPS login page

Hello, I'm trying to accomplish this: http://subdomain.server.com/ should redirect to https://secure.server.com/login?subdomain, but http://subdomain.server.com/any-other-page should pass through as-is. Can I accomplish this in the .htaccess file? ...