Questions tagged [rewrite]

URL Rewriting maps an incoming URL to a modified URL, so that the request is processes as if the original request was made to the modified URL. This is often used to provide more search engine friendly URLs.

Filter by
Sorted by
Tagged with
0 votes
1 answer
219 views

url rewrite to make generated thumnails cache like static, a syntax question

this is a pain in the ass-problem!! Given: most proxies, do not cache resources with a "?" in their URL even if a Cache-control: public header is present in the response. To enable proxy caching for ...
Sam's user avatar
  • 423
4 votes
2 answers
5k views

Apache-style multiviews with Nginx

I'm interested in switching from Apache/mod_php to Nginx for some non-CMS sites I'm running. The sites in question are either completely static HTML files or simple PHP, but the one thing they have in ...
Kenn's user avatar
  • 145
1 vote
1 answer
2k views

Forward (Alias? Redirect? Route?) subdomain to a directory in Nginx config

I would like to alias m.example.com so that the requests are forwarded/aliased to example.com/m/ but without the user being redirected to the /m/ directory. For example, the user accesses m.example....
user avatar
6 votes
1 answer
54k views

URL rewrite with multiple parameters using .htaccess

I have four different types of rewrites I'm trying to do with multiple parameters in each. First, the URLs with no modification: http://www.example.com/index.php?p=/category/page-slug&pn=2/ http://...
VirtuosiMedia's user avatar
0 votes
3 answers
2k views

Rewrite example.com to www.example.com [duplicate]

I want to rewrite urls to the www subdomain if the user omits it, i.e. example.com/something.html to www.example.com/something.html The config below doesn't work, user remains on example.com. There's ...
Mathias Conradt's user avatar
0 votes
1 answer
3k views

.htaccess RewriteRule, send requests to PHP script

I'm trying to protect user uploaded files in directory /secret. I created a htaccess file and placed it into that directory. RewriteBase /secret/ RewriteCond %{REQUEST_URI} !^download.php.*$ ...
Jdoen's user avatar
  • 3
3 votes
2 answers
310 views

Is there an Elegant solution to rewrite long image?query-urls into cachable_nice_urls, using only apache htaccess?

this is a pain in the ass-problem! Whicever genius solves this riddle will receive paypal donation to eat diner for two. Now lets get started. Given: most proxies, do not cache resources with a "?" in ...
Sam's user avatar
  • 423
0 votes
2 answers
8k views

How to rewrite from /page to /xx/page, using htaccess & apache only?

Visualise a three step jump sporting event, with the first two steps perfect in place and the third step launching into air, never coming back and eventually a crash! That is what this question boils ...
Sam's user avatar
  • 423
0 votes
1 answer
281 views

nginx. Proxy subdomain to blogspot

I want to set up my nginx to proxy the subdomain http://blog.mydomain.comtohttp://myblog.blogspot.com, but I don't want to rewrite the url. So the user will see mydomain.com url instead of the ...
user62632's user avatar
0 votes
2 answers
2k views

How to rewrite query strings in url (\img?src=foo.jpg) into cachable urls (\img-foo.jpg)?

a question that is now partially resolved. A genius who can speak Apache fluently can shine light into this matter... GIVEN: Most proxies, do not cache resources with a "?" in their URL even if a ...
Sam's user avatar
  • 423
0 votes
1 answer
360 views

Redirection via mod-rewrite, using apache htaccess only

Hey All, a question about mod-rewrite. When user inputs /somepage?ln=xx my server loads invisibly /xx/somepage which is much a beautiful url. BUT, those ugly pages still reappear cached and i just ...
Sam's user avatar
  • 423
0 votes
1 answer
206 views

Converting Apache RewiteRule to Nginx's

i just installed nginx up and running for serving static content on my site. it works great but the apache rewrite rule about images (ofcourse) stoped working. and i don't have an idea how to convert ...
Ayaz Malik's user avatar
1 vote
1 answer
451 views

Conditional Mod-Rewrite for setting Root Directory ( apache htaccess )

am trying to write a redirect but as a green noob is tougher than i tought. What i want is: on the condition that there are No Specific Page in the url, but the language IS set, it to redirect to the ...
Sam's user avatar
  • 423
0 votes
1 answer
627 views

Beautiful URL mod-rewrite with only 1 exception, using apache htaccess

Dear All, trying to figure out this but no luck. Want to rewrite and beautify this specific ...?ln=zh-CN to /cn/... With the help of a genius @ StackOverflow(Laurence Gonsalves) im almost there! But ...
Sam's user avatar
  • 423
1 vote
1 answer
1k views

Apache Rewrite or Redirect?

I want to redirect a http://site.com/ to http://site.com/url. What is the simplest way to do this? I tried editing httpd.conf and to the redirect command. It didn't worked. Also I tried creating a ...
Jonar's user avatar
  • 171
0 votes
1 answer
6k views

Apache RewriteRule to treat images, css and js files as normal

i need to set up an apache RewriteRule in order to have this behavior: example.com/foo => index.php?module=foo&action=&args= example.com/foo/bar => index.php?module=foo&action=bar&...
Strae's user avatar
  • 487
3 votes
2 answers
6k views

Mask an url in Nginx

I'd like to convert an url with the format http:// foo.example.com:81/foo/s?id=(a number) into something like http:// www.example.com/foo/(a number)/ in Nginx. I've tried with proxy_pass and ...
b82's user avatar
  • 51
0 votes
3 answers
545 views

Apache rewrites to Nginx

I'm trying to install thebuggenie on my Nginx server. Unfortunately, it sits in a subdirectory (nothing I can do about it) and uses apache rewrites for ALL of it's URLs. I had some success when I had ...
user61832's user avatar
0 votes
2 answers
991 views

Nginx rewrite rule equivalent to Apache version

I'm using the PHPThumb script to resize image in a little slider/carousel on my blog, www.muylinux.com. I've completed the migration from Cherokee (we had problems with this webserver) to Nginx, but ...
javipas's user avatar
  • 1,362
1 vote
1 answer
873 views

using nginx, I want to re-write a URL with a .aspx extension

I am moving a .NET application over to a Rails application. I need to re-write the url: www.example.com/users/user.aspx?userid=1231 to www.example.com/users/1231 How can I do this? I don't ...
Blankman's user avatar
  • 2,901
0 votes
1 answer
2k views

Pretty URLs when using Tomcat behind an Apache proxy

We have Tomcat 5.5 running behind and Apache 2.2 mod_proxy. We would like prettier URLs. For example, this is more or less how our URLs look now: http://example.com/foo/app/home (home page) http://...
Reid's user avatar
  • 322
0 votes
2 answers
482 views

nginx rewrite mystery - duplicating hostname and losing https

I am replacing lighttpd with nginx on my development server. I got it working with PHP and SSL, but I'm stumped by what should be a simple rewrite. I need to rewrite URLs from http[s]://dev.foo.com/...
gregjor's user avatar
  • 101
3 votes
2 answers
1k views

Nginx rewrite with an external program

In Apache's mod_rewrite module there is a feature called RewriteMap. This allows an external program to be called to handle the redirects (allowing for more complicated redirecting). Is there an ...
user avatar
1 vote
1 answer
105 views

Hacked WordPress blog

My WordPress Blog is under constant attack with this URL /page/2/?pretty;board=Themes%253btopic%3Ddefault.0 I tried to defend with # BEGIN <IfModule mod_rewrite.c> RewriteEngine On ...
Mike Arnold's user avatar
1 vote
1 answer
4k views

Possible to redirect all traffic from www.***.com to ***.com, in IIS7?

notice how ServerFault.com has no subdomain? If we want to do the same thing with our website -> redirect all traffic from www.***.com to ***.com, how can we do this? At first, I thought it might be ...
Pure.Krome's user avatar
  • 6,608
0 votes
1 answer
809 views

RewriteCond to skip rules if the file exists doesn't work

I'm using this in my conf: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ /index.php?page=$1 [QSA] But files such as /theme/styles....
borntyping's user avatar
0 votes
1 answer
818 views

RewriteRule not working, mod_rewrite installed/loaded on Apache2 Debian Lenny

This is my first time setting up my own linux server. I am migrating from shared hosting to my own cloud. mod_rewrite and mod_proxy are loaded. I know for sure what I have in my htaccess worked on my ...
Bastien's user avatar
  • 123
0 votes
2 answers
572 views

Rewrite test works fine, but not when actually sending mail

When testing the following rewrite rule (Located in /etc/exim4/conf.d/rewrite/31_exim4-config_rewriting) *@*.hidden [email protected] fsrF The test results are as expected xeross@Mainframe:~$ sudo exim ...
Not Available's user avatar
1 vote
4 answers
829 views

Apache RewriteRules don't work, but work when tested with other regex tools?

I have this rule: RewriteEngine On RewriteRule ^/page/([a-zA-Z0-9]+)\?(.*)$ /index.php?page=$1&$2 It should take something like this: /page/contact?cake=lie and go to the page: /index....
borntyping's user avatar
1 vote
1 answer
4k views

Apache .htaccess set base for absolute path

When I test a website in my local installation of Apache I always have /mysite.com/<site files> as the path. When the site gets deployed the root path will be just /. Because I need to use ...
Francisc's user avatar
  • 153
0 votes
1 answer
273 views

URLs with final slash trigger hotlink protection on my server

in all my Apache servers I use hotlink protection because I hate the idea someone could stick my images/flash in their sites using my server bandwidth. In order to make hotlink protection work, in my ...
Marco Demaio's user avatar
1 vote
1 answer
254 views

Running SSL multiple VHOSTS with one IP

I have a site running Apache and it contains multiple VHOSTS. I don't have an option to setup the machine with multiple IP addresses, but I would like to have some way of accessing each VHOST somehow ...
grm's user avatar
  • 425
1 vote
2 answers
9k views

RewriteCond in .htaccess file gives me bad flag delimiters

I'm upgrading a website and I use this .htaccess file to show maintenance page: #MAINTENANCE-PAGE REDIRECT RewriteEngine on RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.0 # Bogus IP address for posting ...
Steven's user avatar
  • 275
0 votes
1 answer
3k views

How to manipulate default document with rewrite module on IIS7?

Until few month ago i've been using IIS 6 where i could add different Default Documents to each websites which are physically same directory. Since II7 which adds Default Document value to web config ...
eugeneK's user avatar
  • 410
0 votes
2 answers
9k views

nginx: all traffic to index.php

How can I send all traffic to a single index.php file regardless of path or domain? What is the fastest way to do this in nginx.conf? try_files? Thanks for insight
ace's user avatar
  • 1
0 votes
1 answer
976 views

Subdomain Proxy/Rewrite with Nginx Proxy

I want to take m.example.com and direct those requests to example.com/mobile/ with nginx. (The same nginx sever will be serving example.com) Can someone help me with the config I would need? I can ...
kkubasik's user avatar
  • 209
0 votes
1 answer
338 views

Rewirte Rules in Nginx

I conisder moving to Nginx but I want you to ask if is possible to rewrite urls into that schema, and if you could help me a bit: A url like example.com/username into profile.php?u=username. But ...
Francesc's user avatar
  • 131
0 votes
1 answer
41 views

modrewrite how to achieve the rewrite

I am struggling to achieve this simple thing... I have some static pages which should be like www.domain.com/profile etc.. The problem is how to write the rewrite rules in order to .. There would be ...
GorillaApe's user avatar
  • 1,379
1 vote
1 answer
3k views

Rewrite rule HTTPS to different port

I have an Apache with SSL running on port 444. I need to rewrite all url/requests starts with https://servername ( that is default port 443) to https://servername:444. I have rule on .htaccess like ...
user37143's user avatar
  • 171
1 vote
1 answer
847 views

IIS7 URLRewrite on a PHP site

I have a PHP site running on IIS7 and I need to add some URL rewriting, but so far it seems to be ignoring my rule. Here's the rule: <rewrite> <rules> <rule name="VCard" ...
JakeS's user avatar
  • 153
0 votes
1 answer
202 views

Where should .htaccess be located for a www.example.com/abc/

I've got a set of webpages-A at www.example.com and I want to setup a set of scripts-B at the location: www.example.com/abc/ I've got an existing .htaccess which is "configured" to be located at an ...
siliconpi's user avatar
  • 1,817
0 votes
1 answer
2k views

URL Rewrite in IIS7 Web Service - WebService.asmx => WebService in the SOAP doc

I have an IIS7.5 (Server 2008 R2) based web service that I would like to make as independant on the current implementations technology as possible. I am using the URL rewrite module (http://learn.iis....
Robert Kaucher's user avatar
0 votes
3 answers
950 views

Apache URL rewrite for subdomain pointing to an existing virtual server resource?

I'm trying to point subdomain.example.com to a resource on subdomain2.example.com/?page_id=1 It's a wordpress blog. I'm attempting to give a static page its own subdomain. The point is to basically ...
user avatar
1 vote
1 answer
947 views

Nginx - redirect all "checkout" traffic to https?

I want to ensure that no one can go through the checkout process without https. How can I redirect anything that starts with /checktout (i.e. example.com/checkout & example.com/checkout/process) ...
Matthew's user avatar
  • 1,927
1 vote
3 answers
499 views

urlrewrite htaccess on symbolic directory

I have a problem using htaccess url rewrite on a symbolic folder. Below is the line which i am using in htaccess file for url rewriting. RewriteRule ^global/css/([0-9]+)/([a-z-_]+)\.css$ global/...
user57221's user avatar
  • 297
12 votes
4 answers
11k views

Configure IIS 7 Reverse Proxy to connect to TeamCity Tomcat

We have an IIS 7 webserver configured and would like to create a reverse proxy for a TeamCity installation using Tomcat on the same machine. The IIS server site is https://somesite and I would like ...
Cynicszm's user avatar
  • 121
5 votes
4 answers
20k views

How to redirect non-www to www without hardcoding using .htaccess?

RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] ...causes a perfect, non-hardcoding 301 redirect from "www to non-www", ...
user avatar
1 vote
1 answer
398 views

Using mathematical operations in IIS 7 Url Rewrite Module

I download the URL Rewrite module for IIS 7. I'm trying to rewrite url of this form: http://www.site.com/1234 to http://www.site.com/234 (get the number and rewrite its modulu by 1000). I saw that ...
Nir's user avatar
  • 154
2 votes
1 answer
2k views

IIS7 URL ReWrite Module: Force to root

We have two sites in IIS7 both on port 80. One is our actual website (MAIN) the other is a maintenance site (MAINTENANCE) that we start (and stop the other one) when we are deploying a new version of ...
neildeadman's user avatar
0 votes
1 answer
72 views

setting up mod-rewrite to handle queries with and without data

I have the following modrewrite rule: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^blog/([^/]*)/([^/]*)/$ /blog.php?date=$1&title=$2 [L] Which is pretty straightforward. My question is, how ...
Chris Sobolewski's user avatar

1
37 38
39
40 41
43