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
3
votes
1 answer

Server.TransferRequest is not preserving HttpContext.Items

I've just updated my ASP.Net code from HttpContext.RewritePath(targetPath) to use the .Net 3.5 function: HttpContext.Server.TransferRequest(targetPath,true) However, I now no longer have any of the custom HttpContext.Items that I added, before the…
the_hoof
  • 43
  • 1
  • 6
3
votes
2 answers

nginx CSS break after adding rewrite from $ to $.php

If I will add the following line to my nginx configuration it will break my website and will run without CSS: location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|svg|xml)$ { access_log off; expires 30d; } location / { try_files…
3
votes
2 answers

How can I convert this Apache Rewrite rule into a Tuckey UrlRewriteFilter Rule?

I have the following Apache Rewrite rule RewriteEngine on RewriteMap tolowercase int:tolower RewriteCond $2 [A-Z] RewriteRule ^(.*)/(.*).html$ $1/${tolowercase:$2}.html [R=301,L] that…
braveterry
  • 3,724
  • 8
  • 47
  • 59
3
votes
1 answer

"non-www to www" and "https" rewrite rule in web.config but not localhost ASP.NET MVC

I have the following rewrite rule in the web.config of my ASP.NET MVC 5 project:
globetrotter
  • 997
  • 1
  • 16
  • 42
3
votes
1 answer

Add dynamic prefix in WordPress page url

I need to add dynamic prefix in page url. You can help with how can I achieve this with Rewrite_API Problem In my WordPress website, I've few pages which I want to access using prefix before the page name in URL. For example, normally page is…
aakash
  • 376
  • 1
  • 5
  • 18
3
votes
1 answer

Question mark in url (Apache)

I have a problem with a question mark in url. For example: I have the url test.com/controller/action/part_1%3Fpart_2 (where %3F is url encoded question mark), and with this rewrite rule: RewriteRule .* index.php/$0 [PT], it should be passed to…
egis
  • 1,404
  • 2
  • 11
  • 24
3
votes
1 answer

Rewriting rule for & in url

How can I setup a rule to replace & with & in url? This works: www.../home.asp?h=1&w=2 This fails: www.../home.asp?h=1&w=2
Vixed
  • 3,429
  • 5
  • 37
  • 68
3
votes
4 answers

htaccess redirect for www to non-www not working

This is driving me bananas. For some reason my domain will not work to redirect https-WWW to https-non-WWW. This works with every other permutation except https://www.nextoronto.com What code do I use in the .htaccess that will allow it to work for…
3
votes
1 answer

How can I remove a file from git using filter-branch making it so I cannot still git grep the contents?

I've been trying really hard to remove a file with sensitive data from my git repository using this excellent page (among others): http://help.github.com/removing-sensitive-data/ the primary line being: git filter-branch --index-filter 'git rm…
Brendan
  • 408
  • 7
  • 8
3
votes
1 answer

Using ExecuteURL as 404 handler in web.config will bypass URL Rewrite (ie.. outboundRules) while using other responseModes won't

I have the following rule in web.config designed to identify and rewrite outbound session cookies with both the secure and httpOnly flags:
Matt Borja
  • 1,509
  • 1
  • 17
  • 38
3
votes
1 answer

URLRewrite "Redirect" rule works, but "Rewrite" rule fails (404)

I have following rewrite rule: This failes, calling…
codetuner
  • 316
  • 3
  • 8
3
votes
2 answers

Intelligencia.UrlRewriter problem with Session state

I have implemented a URL rewriting(extensionless) using Intelligencia.UrlRewriter, it works perfectly on my PC but on the server I am getting the following error Session state can only be used when enableSessionState is set to true, either in a…
GigaPr
  • 5,206
  • 15
  • 60
  • 77
3
votes
1 answer

IIS URL Rewrite, Conditional change in URL

I've got a set of two IIS URL Rewrite rules, based on the "UserFriendlyURL" automatic rule. The point of these two rules is to take the first two querystring parameters (Type, and Series) and convert them to a user friendly URL. This page, if the…
ChristopherBass
  • 301
  • 4
  • 17
3
votes
1 answer

Why use a Url Rewrite Filter in Spring?

A Spring app I'm using declares a Tuckey UrlReWrite Filter and then sets up a rewrite rule as the following: ^/(.*)$ /app/$1 Why do this? Will Spring not be able to recognize requests that do…
3
votes
1 answer

Installing Magento 2.0.2 on Nginx setup page not functioning

Need some help installing Magento 2.0.2 on nginx 1.9.3 with php-fpm currently I'm using the default configuration provided by Magento ( https://github.com/magento/magento2/blob/develop/nginx.conf.sample ). The issue that's happening is when…
PermaNull
  • 33
  • 4