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
24
votes
2 answers

Replace spaces with a dash in a URL

I managed to replace special characters such as : ; / etc in my URL but now it has the spaces again. Here is my code:

Robdogga55
  • 309
  • 1
  • 4
  • 12

24
votes
3 answers

does Request.Querystring automatically url decode a string?

I'm working with a page where I have a url like: /directory/company/manufacturer Using some re-write rules this gets re-written testing with /directory/company/dunkin%26donuts/ Some manufacturers have an ampersand in their name. So I thought I could…
merk
  • 1,721
  • 5
  • 23
  • 39
24
votes
5 answers

Update URL on AJAX call?

Right now the biggest issue I'm having with using AJAX is the fact that if I use AJAX on a page, go to another page, then use the browser's back button to go back anything that was changed with AJAX is gone. I've thought about using the jQuery…
dougoftheabaci
24
votes
5 answers

Line endings messed up in Git - how to track changes from another branch after a huge line ending fix?

We are working with a 3rd party PHP engine that gets regular updates. The releases are kept on a separate branch in git, and our fork is the master branch. This way we'll be able to apply patches to our fork from the new releases of the engine. My…
keo
  • 5,044
  • 2
  • 17
  • 11
23
votes
3 answers

Django: Serving Media Behind Custom URL

So I of course know that serving static files through Django will send you straight to hell but I am confused on how to use a custom url to mask the true location of the file using Django. Django: Serving a Download in a Generic View but the answer…
TheLizardKing
  • 2,014
  • 3
  • 20
  • 27
23
votes
4 answers

URL Rewrite keeps original host Location when reverse proxy 301 redirects

I have URL Rewrite setup on an IIS 7.5 site: http://site1.com/ This acts as a reverse proxy to the second site: http://site2.com/ Here is the flow of events: 1. Browser does a GET on http://site1.com/somepath 2. This gets passed through to site2…
Guy
  • 65,082
  • 97
  • 254
  • 325
23
votes
4 answers

How to route a multiple language URL with a MVC

I need multi-language URL route of existing controller. Let me explain more: I have a controller with name "Product" and View with name "Software"; therefore, by default if the user enters "http://example.com/en/Product/Software", get right content…
Hamid
  • 1,099
  • 3
  • 22
  • 37
23
votes
3 answers

URL rewrite - web.config error

I am getting the following error when i run my .aspx page. Error Code0x8007000d The configuration section 'rewrite' cannot be read because it is missing a section declaration I have a simple v.aspx page which has the following…
Murali Bala
  • 1,133
  • 2
  • 18
  • 28
23
votes
8 answers

IIS URL Rewrite: Add trailing slash except for .html and .aspx

Adding a trailing slash to all URLs through IIS URL Rewrite Module is widely spread, but how do I add exceptions for URLs that ends with .html and .aspx? Today I have this:
Seb Nilsson
  • 26,200
  • 30
  • 103
  • 130
22
votes
1 answer

Why does IIS 7.5 adds a trailing slash on folders? Can we disable courtesy redirect for a URL Rewrite rule that removes trailing slash?

IIS does URL cleanup on directories by adding a trailing slash. See this old docs from IIS 6: IIS generates courtesy redirect when folder without trailing slash is requested Why? Is the intent still relevant? Any security implications? How can I…
Malartre
  • 1,511
  • 18
  • 28
22
votes
10 answers

How to overwrite/reuse the existing output path for Hadoop jobs again and agian

I want to overwrite/reuse the existing output directory when I run my Hadoop job daily. Actually the output directory will store summarized output of each day's job run results. If I specify the same output directory it gives the error "output…
yogesh
  • 231
  • 1
  • 2
  • 5
22
votes
2 answers

How to Simulate & Test URL rewrite rule in Apache 2, when on sharehosting RewriteLog is disabled/unallowed in .Htaccess?

How to Simulate & Check a URL rewrite rule in Apache 2, when on sharehosting RewriteLog is disabled and or NOT allowed to be set in .Htaccess? In other words, are there any tools/simulators to test an url rewrite independantly of hosting, to check…
Sam
  • 15,254
  • 25
  • 90
  • 145
22
votes
4 answers

Url Rewrite in IIS 7.5 causes Internal server error

I have a web application runs @ Windows 2008 R2, ASP.NET v4.0. I installed the Url Rewrite Module, and started to use it as shown in the official examples. My problem starts when the tag is added to the web.config under
Gal V
  • 285
  • 1
  • 4
  • 10
22
votes
4 answers

What is the ideal length of an URL slug

To make pretty URL's from article titles I am using a simple function. However lately I an concerned about the ideal length of these "slugs". It is said that too many dashes are bad. However some article titles can be long and a too long URL may not…
Sinan
  • 5,819
  • 11
  • 39
  • 66
22
votes
7 answers

URL rewriting : css, js, and images not loading

I've following rule for .htaccess Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteRule ^detail/([0-9]+)/?$ detail.php?id=$1 It redirects http://localhost/detail/123 URL to…
Bhavesh G
  • 3,000
  • 4
  • 39
  • 66