Questions tagged [rewrite]

Refers to URL rewriting, or the restructuring of a URL to improve readability and/or search engine optimization (SEO).

URL rewriting relates to the process by which the URL of a website can be restructured/masked from its relative path as dictated by its location in terms of directory and file structure, and replaced with a customized address string which when entered/browsed to, resolves to the same (original) content.

URL rewriting requires a rewrite engine, software located in a Web application framework running on a Web server that modifies a web URL's appearance.

Rewritten URLs (sometimes known as short, fancy URLs, search engine friendly - SEF URLs, or slugs) are used to provide shorter and more relevant-looking links to web pages. The technique adds a layer of abstraction between the files used to generate a web page and the URL that is presented to the outside world.

4045 questions
32
votes
1 answer

IIS URL Rewrite https rule ignoring localhost

I'm trying to write a URL rewrite rule to force a HTTPS connection. This should always happen except when a request is using localhost (e.g. http://localhost/mysite). The rule is configured as following:
One of many
  • 477
  • 1
  • 4
  • 8
32
votes
1 answer

Nginx convert subdomain to path component without redirect

The idea is to take incoming requests to http://abc.example.com/... and rewrite them to http://example.com/abc/... That's easy enough to do with a 301/302 redirect: # rewrite via 301 Moved Permanently server { listen 80; server_name…
Sebastian Goodman
  • 1,605
  • 1
  • 11
  • 13
31
votes
3 answers

asp.net, url rewrite module and web.config

i'm using ASP.net with .NET 3.5 on IIS7 (Vista) with the URL Rewrite Module from Microsoft. This means, that i have a ... ... section within the web.config, but i get a warning,…
Christoph
  • 885
  • 1
  • 12
  • 21
31
votes
5 answers

Options FollowSymLinks or SymLinksIfOwnerMatch is off

I've read almost everything possible for this issue and couldn't find anything that would solve my problem. This is erorr log I'm getting: Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden:…
user1590251
  • 311
  • 1
  • 3
  • 5
30
votes
5 answers

How i can translate uppercase to lowercase letters in a rewrite rule in nginx web server?

I need to translate the address: www.example.com/TEST in ---> www.example.com/test
Peak
  • 301
  • 1
  • 3
  • 5
30
votes
10 answers

How to rewrite location in nginx depending on the client-browser's language?

How to rewrite location in nginx depending on the client-browser's language? For example: My browser accept-language is 'uk,ru,en'. When I request location mysite.org nginx must forward to mysite.org/uk
RKI
  • 383
  • 2
  • 4
  • 10
28
votes
2 answers

rewrite a folder name using .htaccess

I am wondering wether it's possible to use .htaccess to rewrite a folder name. What I mean is this. Lets say I have a url like: www.site.com/folder1/page.php Now I want to rewrite the url to (for example) www.site.com/apple/page.php The folder1…
sanders
  • 9,976
  • 25
  • 81
  • 123
27
votes
2 answers

nginx rewrite WITHOUT change url

I want to use rewrite function in my nginx server. When I try "http://www.example.com/1234", I want to rewrite "http://www.example.com/v.php?id=1234" and want to get "http://www.example.com/1234" in browser. Here is nginx.conf file ... location ~…
user1850593
  • 305
  • 1
  • 3
  • 7
26
votes
5 answers

mod_rewrite: remove trailing slash (only one!)

I use mod_rewrite/.htaccess for pretty URLs. I'm using this condition/rule to eliminate trailing slashes (or rather: rewrite to the non-trailing-slash-URL, by a 301 redirect; I'm doing this to avoid duplicate content and because I like URLs with no…
user367217
  • 499
  • 1
  • 6
  • 20
24
votes
5 answers

convert htaccess to nginx

I'm having no luck converting htaccess rules to nginx rewrite. I've checked out the NginxRewriteModule documentation and have a few done, but the more complicate ones I'm at a loss for. Here's what I'm looking at: RewriteRule ^$ …
cheifops
  • 309
  • 1
  • 3
  • 6
24
votes
5 answers

rewrite rules for apache 2 to use with angular js

Obviously, there are a lot of mod rewrite discussions and answers all across the web. However, I am having a hard time grasping them. So I thought I would ask here. I'm asking for rewrite rules to do what Andy Joslin explained in the comments here:…
Mike Haas
  • 1,773
  • 2
  • 19
  • 29
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
  • 4,746
  • 2
  • 14
  • 11
23
votes
2 answers

Use 301 or 303 to redirect http to https

I'm not sure which is the best to use for my site when redirecting from http to https. At the moment I am using IIS rewrite rules to do the redirect. The guides I've read on how to do this use either a 301 or a 303. And after reading up on 301 and…
garethb
  • 3,615
  • 4
  • 28
  • 49
22
votes
4 answers

Remove parameters within nginx rewrite

I'm rewriting URLs in nginx after a relaunch. In the old site I had query parameters in the URL to filter stuff e.g. http://www.example.com/mypage.php?type=4 The new page doesn't have these kind of parameters. I want to remove them and rewrite the…
lorem monkey
  • 3,712
  • 3
  • 32
  • 47
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