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
133
votes
13 answers

How can I easily fixup a past commit?

I just read amending a single file in a past commit in git but unfortunately the accepted solution 'reorders' the commits, which is not what I want. So here's my question: Every now and then, I notice a bug in my code while working on an (unrelated)…
Frerich Raabe
  • 81,733
  • 18
  • 105
  • 196
117
votes
16 answers

Gmail's new image caching is breaking image links in newsletter

I've got some automatic emails that are sent out upon signup completion for my site. Until recently, they worked fine. Now Google's new system is rewriting the images and storing them in it's cache (supposedly) However, Google's new rewriting of my…
RonnyKnoxville
  • 5,103
  • 9
  • 37
  • 67
92
votes
10 answers

Header set Access-Control-Allow-Origin in .htaccess doesn't work

I can't figure out why my .htaccess header settings doesn't work. My .htaccess file content: Header set Access-Control-Allow-Origin * Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT" Header always set…
user1401592
  • 929
  • 1
  • 7
  • 4
71
votes
6 answers

Is it possible to rewrite a status code with Charles Proxy?

I'm using Charles Proxy to rewrite a response from an API for testing purpose. If I set a breakpoint, I am allowed to completely rewrite the raw response as I wish. However, if I want to automate it via the "Rewrite" tool, I'm stuck, it seems that…
Thomas
  • 1,040
  • 1
  • 7
  • 13
61
votes
9 answers

Add slash to the end of every url (need rewrite rule for nginx)

I try to get an "/" to every urls end: example.com/art should example.com/art/ I use nginx as webserver. I need the rewrite rule for this.. For better understanding check this: http://3much.schnickschnack.info/art/projekte If u press on a small…
Gomez
  • 1,111
  • 2
  • 10
  • 10
48
votes
4 answers

Rewrite URL after redirecting 404 error htaccess

So I know this may seem a little strange but I for sake of consistency, I would like all my urls to appear in this form: http://domain.com/page/ So far I have gotten the regular pages working but I cannot seem to get the error pages working…
46
votes
8 answers

Is this the best way to rewrite the content of a file in Java?

I want to rewrite the contents of a file. What I have thought of so far is this: Save the file name Delete the existing file Create a new empty file with the same name Write the desired content to the empty file Is this the best way? Or is there a…
Ankur
  • 47,089
  • 107
  • 237
  • 309
45
votes
19 answers

Python Performance - have you ever had to rewrite in something else?

Has anyone ever had code in Python, that turned out not to perform fast enough? I mean, you were forced to choose another language because of it? We are investigating using Python for a couple of larger projects, and my feeling is that in most…
Dutch Masters
  • 1,301
  • 15
  • 19
43
votes
1 answer

logging proxy activity in nginx

I am using rewrite and proxy_pass and I am having some intermittent issues with the site I am proxying said rewrites too. Is there a means to log the proxy activity so I that I can debug this problem?
hinder90
  • 501
  • 1
  • 4
  • 7
40
votes
7 answers

Nginx rewrite non-www-prefixed domain to www-prefixed domain

I see the Nginx HttpRewriteModule documentation has an example to rewrite a www-prefixed domain to a non-www-prefixed domain: if ($host ~* www\.(.*)) { set $host_without_www $1; rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains…
saltycrane
  • 6,129
  • 5
  • 31
  • 43
39
votes
1 answer

.htaccess RewriteRule to preserve GET URL parameters

I'm having issues keeping the parameters of the url working after an htaccess url rewrite. My htaccess rewrite is as follows: RewriteEngine on RewriteRule ^([a-z]{2,2})/([a-zA-Z0-9_-]+)$ index.php?lang=$1&page=$2 Which…
Enkay
  • 1,799
  • 6
  • 23
  • 34
36
votes
2 answers

"OR" Flag in .htaccess mod_rewrite

Just found this .htaccess rewrite code RewriteEngine on RewriteCond %{HTTP_HOST} ^my.domain.com$ [NC,OR] RewriteCond %{REQUEST_URI} !public/ RewriteRule (.*) /public/$1 [L] And I was wondering what was the purpose of the "OR" flag. Already checked…
gabriel-kaam
  • 1,110
  • 1
  • 10
  • 13
35
votes
2 answers

DDD, Anti Corruption layer, how-to?

At the moment, we have to build an application which is based on a legacy one. Code for that old application should be thrown away and rewritten, but as it usually goes - instead of rewriting it, we need to base something new on it. Recently, we…
Arnis Lapsa
  • 39,296
  • 27
  • 111
  • 190
33
votes
5 answers

Preserve HTTP/HTTPS protocol in .htaccess redirects

I have to redirect port 80 to 2368 in htaccess but I'd like to keep the requested protocol intact so that SSL doesn't break. I currently have this: RewriteCond %{HTTP_HOST} ^sub.domain.com$ [NC] RewriteRule ^ http://sub.domain.com:2368%{REQUEST_URI}…
Vince Kronlein
  • 2,994
  • 4
  • 36
  • 60
33
votes
3 answers

Apache 301 Redirect and preserving post data

I have implemented SEO URLs using Apache 301 redirects to a 'redirect.cfm' in the root of the website which handles all URL building and content delivering. Post data is lost during a 301 redirect. Unable to find a solution so far, have tried…
Daniel Cook
  • 923
  • 1
  • 7
  • 16
1
2 3
99 100