url-rewriting

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...

IIS7 URL Rewrite - Add "www" prefix

How to force example.com to be redirected to www.example.com with URL rewriting in IIS7? What kind of rule should go into the web.config? Thanks. ...

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 ...

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...

What's the difference between Request.Url.Query and Request.QueryString?

I have been tracking down a bug on a Url Rewriting application. The bug showed up as an encoding problem on some diacritic characters in the querystring. Basically, the problem was that a request which was basically /search.aspx?search=heřmánek was getting rewritten with a querystring of "search=he%c5%99m%c3%a1nek" The correct value (...

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...

URL Encoding with Underscores in a Directory Name?

We've run into an odd argument where I work, and I may be wrong on this, so this is why I am asking. Our software outputs a directory to an Apache server that replaces an underscore with a %5F in the name of the directory. For instance if the name of the directory was listed as a string in our software it would be: "andy_test", but t...

Zend_Controller_Router: Get language from translated segment

I want to use a URL rewrite on my site: /:@controller/:@action/ So I want to use translated segments on route and I want to detect requested language from these translated segments. For example, if user request a url like this: /user/profile/ then I could understand that requested language is English. And if user request a url like...

Keep IIS 7 URL Rewrite module from matching /ScriptResource.axd

I have a website and I have installed URL Rewrite using Web Platform Installer. I wish to allow a user friendly URL like www.foo.com/123456 to go to www.foo.com/page.aspx?blah=123456. Using the User-friendly URL template accomplishes this except that the created rule also matches all of the /scriptresource.axd?blahblah created by ASP.NE...

Get full url and split into an array with JSP/ASP

In PHP/Apache I can get the full url and cut it up into parts like this URL: mysite.com/friends/enemies-cats/ Then using PHP explode function I can split the URL by the "/" into an array. Array[0] = 'friends'; Array[1] = 'enemies-cats'; I wonder, is it possible to do the same thing on a Java server. I am hoping the same thing could ...

Using IIRF to redirect to a PDF

I'm using IIRF to redirect certain URLs to specific PDF files. For instance, for the URL /newsletter/2010/02 I'd like it to redirect to /pdf/newsletters/Feb2010.pdf. I'm not too hot at regular expressions, but I created the following rule: RedirectRule ^/newsletter/2010/01 /pdf/newsletters/Newsletter012010.pdf [I,R=301] and it doe...

Htaccess Rewrite Not Found

I'm using Mod Rewrite to remove index.php. I do not want to use queries. I want foo.com/bar to be interpreted as foo.com/index.php/bar. It does this fine, but gives me Not Found error. The requested URL /home/foo/www/index.php/bar was not found on this server. Why!! ...

www.example.com does not work, but example.com does

This question could be posted on ServerFault as well, however there is definitely a coding element involved due to the rewrite rules in my web.config. This is why the question does indeed have a home on SO. I've recently deployed a website to a new server and have discovered that trying to access my site via www.example.com returns a 4...

Apache URL Rewriting with n arguments

I'm doing some URL rewriting and I can accomplish what I need to do with the following: RewriteRule ^([^/]*)/([^/]*)$ index.php?arg1=$1&arg2=$2 [L,QSA] RewriteRule ^([^/]*)$ index.php?arg1=$1 [L,QSA] You get what I'm trying to do here, I basically want to take the full url and parse it into individual arguments. So /blah/test/asdf/hi...

Help with complex nginx rewrite rules for subdomains needed please

I currently have the following (hacky) re-write rule in my nginx.conf to allow dynamic sub-domains to be re-directed to one Django instance. set $subdomain ""; set $subdomain_root ""; set $doit ""; if ($host ~* "^(.+)\.domain\.com$") { set $subdomain $1; set $subdomain_root "/profile/$subdomain"; set $doit TR; } if (!-f $req...

IIS URL Rewrite Module : Redirect Based On QueryString

Hi there, I Have some problems with redirecting to another URL based on the query string parameters. I want to redirect users which enter www.domain.com/signup.aspx?p=1 to: www.domain.com/signup <rule name="Signup Redirect 1" stopProcessing="true"> <match url="signup\.aspx\?p=1" /> <conditi...

How to evaluate Javacript within C#? (need to get all links for a web page, including java-script generated ones)

Hi, Background: I have to download webpages with their resources for offline viewing, however as part of this I have to "rewrite" the URL's for links with the HTML webpage so they work. This is fine more the standard types of links however I'm realizing now that there are some links that are dynamically created by javascript. Questi...

Converting an ExpressionEngine rewrite rule for and NginX server

I'm trying to migrate a working ExpressionEngine installation from an Apache environment over to an NginX environment on a different box. I have come across a problem trying to convert some .htaccess rewrites to NginX. The site uses the multi language module so needs a custom rewrite rule for every additional language. This is my stand...

Modify url withut changing the code

Hello all, I want to change my current url to a modified one. suppose my current url is www.abc.com/xyz/location.htm i want it to change to www.abc.com/location.htm please suggest a suitable way.... Thanks in advance ...