Questions tagged [url-rewriting]

A URL rewrite engine is software that modifies a web URL's appearance (URL rewriting). Rewritten URLs are used to provide shorter and more relevant-looking links to web pages, to route users from obsolete URLs to replacements, or to simplify the format of the URL for human readability. The technique adds a degree of separation between the files used to generate a web page and the URL that is presented to the world.

A URL rewrite engine, part of a web server's URL-to-filename mapping engines, is software that modifies a web URL's appearance (URL rewriting). Rewritten URLs (sometimes known as short, fancy URLs, or search engine friendly - SEF) are used to provide shorter and more relevant-looking links to web pages, to route users from obsolete URLs to replacements, or to simplify the format of the URL for human readability. The technique adds a degree of separation between the files used to generate a web page and the URL that is presented to the world. It is integral in frameworks that route all URI requests through a routing script or a controller.

Useful links

  1. and its tag-wiki for some examples regarding the most widely-used implementation for the Apache web server.
  2. and its tag-wiki for an implementation for java/j2EE technology.
20479 questions
10
votes
1 answer

What would cause PHP variables to be rewritten by the server?

I was given a VM at my company to install web software on. But I came across a rather bizarre issue where PHP variables would be overwritten (rewritten) by the server if they matched a specific pattern. What could rewrite PHP variables like…
Highway of Life
  • 22,803
  • 16
  • 52
  • 80
10
votes
1 answer

Cannot match %2F in mod_rewrite

I have a set of rewrite rules (in a .htaccess) something like this: RewriteRule ^list/vendor/(.*)$ list.php?vendor=$1 RewriteRule ^list/product/(.*)$ list.php?product=$1 RewriteRule ^list/(.*)$ list.php?search=$1 (I don't think the first two are…
LHMathies
  • 2,384
  • 16
  • 21
10
votes
1 answer

Rewriting Ampersand URLs with IIS 7 Rewriting Module

How can I use an ampersand (&) in my url rewrite rules in the web.config file? I want to rewrite the url: http://www.foo.com/index.asp?SomeParameter=SomeValue&SomeId=00 to: http://www.foo.com/Section/Page I wrote the following rule in my…
Pato
  • 679
  • 8
  • 24
10
votes
2 answers

TeamCity behind nginx proxy

I am trying to set up TeamCity behind nginx. I'd like https://public.address.com/teamcity/... to redirect to http://127.0.0.1:8111/..., but even though nginx does this successfully, the login page comes back with references that look like…
Marcelo Cantos
  • 181,030
  • 38
  • 327
  • 365
10
votes
0 answers

IIS 7.5 URL Rewrite Module with non-existent files and no extensions

I'm using the IIS URL Rewrite module successfully for known file extensions (.aspx, .html, etc.) However, how can I use the IIS URL Rewrite module for requests with no extensions, or files that do not exist? For…
Tim P.
  • 2,903
  • 24
  • 26
10
votes
2 answers

ASP.NET postbacks creates issue in URL rewriting?

I am using Intelligencia for url rewriting in my asp.net project. I have solved many issues by doing R & D for url rewriting but right now i stuck with one issue regarding page postback. page postback change my rewrite url to original url. SO,…
sikender
  • 5,883
  • 7
  • 42
  • 80
10
votes
3 answers

Policy rewrite-uri To Append Context Variable in Azure APIM

What is the approach to a simple append to the url of a context variable such as context.Variables["accountKey"] during a policy rewrite? The end result should be /accounts/232. I have success earlier in setting it set-variable (0.003 ms) { …
ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
10
votes
4 answers

Remove multiple trailing slashes in root using htaccess

I have a rule in my htaccess file to remove any extra trailing slashes from a url, this works on sub-directories with any more than 1 trailing slash. However it doesn't work on the root; which i need it to do. For…
LazyAlpine
  • 101
  • 1
  • 8
10
votes
2 answers

How to know the original url after url rewrite?

I have url rewrite rules which redirect www.domain2.com to a subfolder under the root of a domain1.com (let's call this folder subproject). In my controller, I need to construct a URL to the original non modified path but the Request.Url properties…
Nicolas Cadilhac
  • 4,680
  • 5
  • 41
  • 62
10
votes
2 answers

How to block search engines from indexing all urls beginning with origin.domainname.com

I have www.domainname.com, origin.domainname.com pointing to the same codebase. Is there a way, I can prevent all urls of basename origin.domainname.com from getting indexed. Is there some rule in robot.txt to do it. Both the urls are pointing to…
Loveleen Kaur
  • 993
  • 4
  • 16
  • 36
10
votes
2 answers

Azure CDN rules engine to rewrite default document and remove .html extension

I would like to use azure blob and CDN premium features but the documentation is very sparse. This is something totally doable on Amazon S3 / CloudFront. For clarity I want *.azureedge.net/sample/index.html to equal*.azureedge.net/sample/ and…
glued
  • 2,579
  • 1
  • 25
  • 40
10
votes
3 answers

Url rewriting in ASP.NET Core RC2

How can I accomplish URL rewriting in ASP.NET Core RC2? Migrating from RC1 to RC2 broke my Angular 2 routing when I refresh the page. I was using a rule like this before in my web.config located in my wwwroot. With RC2 I'm not even sure if I'm…
twilliams
  • 475
  • 1
  • 6
  • 20
10
votes
4 answers

IIS7, RewritePath and IIS log files

I am using Context.RewritePath() in ASP.NET 3.5 application running on IIS7. I am doing it in application BeginRequest event and everything works file. Requests for /sports are correctly rewritten to default.aspx?id=1, and so on. The problem is that…
markom
  • 2,040
  • 1
  • 21
  • 29
10
votes
1 answer

IIS URL Rewrite - with multiple domains

I have a website/application where the same pages run many websites (depending on the URL the pages display different logo/css/content etc). I am trying to force each website domain to redirect to the www. verison of the domain. I have used the…
Jammer
  • 2,330
  • 11
  • 48
  • 77
10
votes
2 answers

Request.Url.AbsoluteUri and rewritten URL's

I need to be able to get the URL as I see it in the browser i.e The rewritten one. For instance: If my Url was www.myurl.com/Test.html and I then used Request.Url.AbsoluteUri, the URL returned would be: www.myurl.com/Default.aspx?Action=Test I need…
webnoob
  • 15,747
  • 13
  • 83
  • 165