mod-rewrite

mod_rewrite to absolute path in .htaccess - turning up 404

I want to map a number of directories in a URL: www.example.com/manual www.example.com/login to directories outside the web root. My web root is /www/htdocs/customername/site the manual I want to redirect to is in /www/customer/some_other_dir/manual In mod_alias, this would be equal to Alias /manual /www/customer/some_other_d...

mode_rewrite: example.com/münster -> example.com/index.html?city=münster

Like described in the title i would like to have clean URLs with mod_rewrite, sadly i didnt manage to write the fitting regex to get the job done i am experimenting with: 1.try: RewriteRule ^([a-z]*)$ /index.html?city=$1 [NC,L] 2.try: RewriteRule ^(.*)$ /index.html?city=$1 [NC,L] But none is working properly, even less when it com...

htaccess rewriterule question

RewriteRule ^([a-z]{2}/){0,1}showCategory/([0-9]*)/[a-z\-_0-9\+]*/mp/(.*)(/{0,1})$ /main.php?id=$2&il[lang]=$1&$3 [L] RewriteRule ^([a-z]{2}/){0,1}showCategory/([0-9]*)/[a-z\-_0-9\+]*/(.*)/mp/(.*)(/{0,1})$ /main.php?id=$2&il[lang]=$1&page=$3&$4 [L] RewriteRule ^([a-z]{2}/){0,1}showCategory/([0-9]*)(/{0,1})/[a-z\-_0-9\+]*$ /main.php?id=...

Absolute file paths in mod_rewrite - allowed?

This is a follow-up to this question. I am trying to build a mod_rewrite rule where the rewriting target is an absolute path outside the web root, like RewriteRule ^manual(/(.*))?$ /www/htdocs/customername/manual/$2 [L] I need to do this because I can't use Alias in a .htaccess context (shared hosting). There are responses hinting a...

RewriteRule in .htaccess not working

I am currently running Apache2 on my local machine, installed with the latest version of Ubuntu. I am trying to get basic URL rewriting working by using the .htaccess file. The file "http://localhost/page.php?=home" does exist, and the location "/doesnotexist/home" does not. I would like to have the first page be loaded when the secon...

Redirect user to a directory using mod_rewrite - Simple question

Hi, I'm trying to do so if the user going to this url: http://www.abc.com/ it will redirect him to http://www.abc.com/minisite/ or, if he's going to tihs url: http://www.abc.com/dir/something.php it will redirect him to: http://www.abc.com/minisite/dir/something.php I'm trying to do this in Mod_Rewrite... Here is what I've wrrite...

Mod Rewrite question with regex's

Im trying to do this sort of rewrite that only affects some urls to make them go to anchors. So if I see this request: /somedir/trigger/something I want to transform it to this request. I can guarantee there will be no slash after the trigger. The "something" part is going to be a alpha-numeric string every time. The "trigger" part i...

How to rewrite paths on single SSL secured subdomain to secure web apps on other subdomains using htaccess

Let's say I have an SSL secured domain at secure.domain.com. I also have a web application (using silverstripe) at www.domain.com and another at app.domain.com (using CakePHP) I would like specific areas of www.domain.com and app.domain.com to utilize SSL, and thus must somehow rewrite the paths using the subdomain with the installed S...

Server opens /search.php instead of /search/

Ok, i have a simple .htaccess for my engine. It simply rewrites all requests to index.php (much like Wordpress does). RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] Now, i've run into an issue. I have search.php, which should be included with index.php. But, when i try to open exam...

Needing some mod_rewrite help...

I have a php script that takes in five variables from the url string like this: /dimg.php?s=250x250&tc=0-0-0&bc=204-204-204&type=jpg&t=blahText The only required variable is s. The script defaults if all the others are not set. My question is how do i get the url to look like this with mod_rewrite: /dimg/250x250/0-0-0/204-204-204/jpg...

.htaccess mod_rewrite help

Hi, noob when it comes to .htaccess. I need a mod_rewrite of a URL. URL example is as shown: http://example.com/folder/script.php?location=UK&Name=Fred I want it to transform to: http://example.com/folder/UK/Fred ...

How do I modify Request_URI using Apache or PHP?

I'd like some help with some URL rewriting magic. I am having trouble modifying the Request_URI variable. I would like to switch between two sites http://host.com/alpha and http://host.com/beta. They are both handled by the same php script. This script is http://host.com/index.php. The index.php expects to be given a GET variable SITE ...

Need help with wp_rewrite in a WordPress Plugin

Ok, I've got this code that I've been using to spit out news to an application of mine. It was working until today. I've cutout all the logic in the following code to make it simpiler. But it should "WORK" Can someone help me fix this code to where it works, and is done right? I know it's hacked together ,but it didn't seem to have ...

.htaccess ModRewrite question

trying to do rewrite rule for this: http://website.com/checkreg/34324234 <--- Old URL Location to this: http://website.com/chkreg.php?checkreg=34324234 <--- New URL Address I've tried the following, but it causes an error 500 message, I don't know enough about ModRewrite to figure out the issue. # BEGIN WordPress IfModule mod...

mod_rewrite to move Wordpress images to Amazon S3

Basically, I'm moving all my images over to s3, but will have tons of old references to old image locations on my website. Looking to rewrite anything in the wp-content/uploads/ folder to an s3 address. Short story is I'm not very good with regular expressions, and have been at it a while already. Any advice or help would be greatly ap...

PHP & Apache - parse mod_rewrite url

Hi, I have my server's apache configured to redirect every request into index.php, so that I can use urls like : http://www.website.com/about/us Now I need to parse the url in order to determine if each route exists and what to expect from it, so I can set a database table to save the routes and so my clients can edit their routes as...

Problem with getting to the second rewrite rule: is the first too general?

Hi, as i describe already above if i call e.g. /berlin it properly routes, but if i try /berlin-blabla-50-prozent-rabatt.html it also takes the first rule,i'm not sure how to negate the regex telling if it has "-" or something like that take the second. I also got a problem, if i put a trailing / it also breaks, do i have to add a third ...

How can I make the -f flag apply to directories with a trailing slash?

I am building a .htaccess file with a fairly complex ruleset. One of the basic rewriting rules is this first line: If a requested file exists physically, no rewriting, stop processing rules. RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule . - [L] this works well with one exception: When I acces...

Cleaning up nested mod_rewrite statements

I am cleaning up a large .htaccess file containing a lot of mod_rewrite statements. The biggest part of the clutter comes from statements catching various occurrences of /directory1 /directory1/directory2 /directory1/directory2/directory3 using statements like RewriteCond %{REQUEST_URI} ^/([^/]+)/([^/]+)$ RewriteRule .* /front....

.htcaccess redirect ONLY root ("/") to sub folder

I have a site that is arranged thus: /about /css/ /index/index.php /js/ /index.php index.php uses a PHP redirect to index/index.php I want to create a .htaccess rewrite rule so that when the root is accessed, /index/index.php is displayed BUT /about etc. stays the same. ...