Все вопросы: [rewrite]

87 вопросов

0
голосов
1ответов
996 просмотров

Правило перезаписи Nginx: проверьте несуществующие файлы и папки

Я пытаюсь настроить правила перезаписи nginx следующим образом: Исходная структура: domain.com/index.php?site=project Теперь я попытался замаскировать это с помощью движка перезаписи nginx: if (-f $request_filename) { break; } if (!-f $request_filename) { ...

0
голосов
2ответов
112 просмотров

Справка по изменению URL

RewriteEngine on RewriteCond %{REQUEST_URI} !^/index\.php RewriteRule ^(.*)$ index.php?q=$1 [L] Это должно переписать любой URL-адрес на index.php? q = {url}, и он заработает.В любом случае, http://www.domain.com/ просто показывает пустую страницу.Как я могу переписать / в index.php?(http://...

0
голосов
2ответов
2407 просмотров

htaccess rewrite не работает по всем правилам

Это очень странная проблема, и я просто надеюсь, что смогу ясно ее объяснить. По сути, сегодня мы сделали крупное обновление на клиентском сайте, и нам нужно было обновить некоторые правила перезаписи в htaccess, чтобы приспособить новую структуру и т. д. Итак, где у нас изначально были та...

39
голосов
7ответов
48578 просмотров

Nginx переписывает домен без префикса www в домен с префиксом www

Я вижу, что в документации по HttpRewriteModule Nginx есть пример перезаписи домена с префиксом www в домен без префикса.Домен с префиксом www: if ($host ~* www\.(.*)) { set $host_without_www $1; rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains '/foo', not 'www.mydomai...

5
голосов
7ответов
1780 просмотров

Rewriting C# code in F#

Just messing about with F# and I was trying to create a basic Lagrange Interpolation function based on this C# version (copied from a C++ wiki entry): double Lagrange(double[] pos, double[] val, double desiredPos) { double retVal = 0; for (int i = 0; i < val.Length; +...

1
голосов
1ответов
714 просмотров

ASP.NET MVC 2 and custom httpModule precedence

I have a custom HttpModule rewrite engine in an existing web application project that maps urls of the form /tom/dick/harry/.../.../... to a hierarchical navigation system stored in a database, ultimately resulting in a HttpContext.Current.RewritePath() call to the .aspx page that the requested...

1
голосов
1ответов
3099 просмотров

Nginx rewrite for URI querystring value

I changed my website platform and i am now getting hits from google pointing to the old location of tag searches on my site. Basically i need to point: http://www.website.com/articles/Subject%3Alist=Music-Oldies&review_state=published to: http://www.website.com/tags/Music-Oldies ..in m...

2
голосов
2ответов
2706 просмотров

Apache2 + RewriteMap + Python -- when returning 'NULL', apache hangs

[SOLVED: See solution below.] I'm having a problem writing a RewriteMap program (using Python). I have a RewriteMap directive pointing to a Python script which determines if the requested URL needs to be redirected elsewhere. When the script outputs a string terminated by a linebreak, Apache r...

2
голосов
2ответов
187 просмотров

REALLY basic mod_rewrite question

I am trying to use SEO-friendly URLs for a website. The website displays information in hierarchical manner. For instance, if my website was about cars I would want the URL 'http://example.com/ford' to show all Ford models stored in my 'cars' table. Then the URL 'http://example.com/ford/explor...

1
голосов
2ответов
11787 просмотров

Create custom rewrite rule for my WordPress plugin

I'm writing a plug-in for WordPress which in fact will be a separate ordering module (it will be placed in an IFRAME on the site I'm developing as well as others) but with its admin tied into WordPress. I wrote the administration part without too much hassle, however I'm having trouble with the f...

0
голосов
3ответов
530 просмотров

C# best way to call .ToString() on an object

How would you write a call to the .ToString() method on an object of type object that can be null. I currently do the following, but it's pretty long : myobject == null ? null : myobject.ToString()

1
голосов
2ответов
1281 просмотров

Removing index.php from URL but keep old links working

I'm trying to remove the index.php from the URL, which is working with the .htaccess examples found on the EZPublish site and ForceVirtualHost=true. The problem is that the old links that point to index.php are no longer working (which is problematic when linking from search engines). I've tried ...

4
голосов
4ответов
9423 просмотров

How do I delete the first "X" lines of a text file?

For a project that I am doing, one of the things that I must do is delete the first X lines of a plaintext file. I'm saying X because I will need to do this routine multiple times and each time, the lines to delete will be different, but they will always start from the beginning, delete the first...

0
голосов
2ответов
59 просмотров

Under what situation will .htaccess not work for Apache?

vi .htaccess: RewriteEngine on RewriteCond $1 !^(index\.php|audio|editor|upload|images|js|css|robots\.txt|sitemap\.xml) RewriteRule ^(.*)$ /index.php?$1 [L] When I try to browse http://wolaitiao.cn/install,it reports 404,so it's not working correctly. Is it because it's a VirtualHost? <Vi...

2
голосов
1ответов
1134 просмотров

URL Rewrite affecting virtual application root for all asp.net controls

I am using the following rule to map a domain through to a subfolder in my shared hosting environment: <rule name="mydomain.co.uk"> <match url="(.*)" /> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_HOST}" pattern="^www.mydomain.co.uk$" /> <add input="{HTTP...

2
голосов
3ответов
359 просмотров

How to get personalized sub-domains for users and make them work?

Say I have a site hosted on example.com, now I want each of my registered user to get a personalized sub-domain, e.g Alice should normally gets alice.example.com as her sub-domain. While actually alice.example.com gets data from example.com/user/alice. How to implement this mechanism? I see lots ...

1
голосов
2ответов
267 просмотров

.htaccess rewrite rule

How do I write a rewrite rule for the following condition. I have my directory setup as /root/projectname/trunk/www/ I've setup site.local in hosts file to point to /root/ How do I make this request http://site.local/projectname to grab data from /root/project_name/trunk/www/ instead of fro...

8
голосов
3ответов
8004 просмотров

What is the regular expression to match the empty string for a rewrite rule?

I need a regular expression for a rewrite rule on iis7, I'm trying to redirect http://www.website.com to http://www.website.com/sample. But I only want the empty url string (extra points if you can figure it out with and without '/'), and I'm unsure how to create a rewrite rule to match to that....

2
голосов
2ответов
666 просмотров

Stopping mod_rewrite rule match, circular execution

I have old.htm and new.htm on a directory, and I need to load file.php every time someone access old.htm, and load old.htm every time some access new.htm. Here are my non-working rules: RewriteRule ^old\.htm$ file.php?%{REQUEST_URI} [L] RewriteRule ^new\.htm$ old.htm [L] When old.htm is acces...

0
голосов
4ответов
1889 просмотров

Redirect pages from old to new site - one by one

I'm trying to redirect pages from several old domains on one new domain on a page-to-page basis, that is: page 1: http://www.example.org/default.asp?id=1 redirects to http://www.example2.org/newpage.html page 2: http://www.example2.org/default.asp?id=2 redirects to http://www.example.org/contact...

12
голосов
4ответов
13619 просмотров

Show no_picture.png by .htaccess if picture is not exist

I want to show no_picture.png if requested picture does not exists. I should do it with .htaccess. Thanks a lot.

1
голосов
3ответов
333 просмотров

WebForms / MVC to a Windows Forms programmer

First I'd like to make it clear, I'm not looking for a "my tech is better than yours" type of post; this is a real case scenario and I have been faced with this decision. With this in mind, let me explain: We have a WinForms application. It started in the early .NET 1.0 but the first shipping ve...

2
голосов
4ответов
2768 просмотров

Apache Redirects/Rewrite Maximum

I have a migration project from a legacy system to a new system. The move to the new system will create new unique id's for the objects being migrated; however, my users and search indexes will have the URLs with the old ids. I would like to set up an apache redirect or rewrite to handle this but...

2
голосов
13ответов
330 просмотров

how to decide between a rewrite or a hardware upgrade?

If you had a working product that was slow and memory hungry. What would decide to do between these 2 options and why? The product would work perfectly if you buy "the" good server which would be high in the 5 digits and maybe in the 6 digits. You have the sources and the resources to change ...

2
голосов
3ответов
2414 просмотров

Rewrite to a new domain? with url query? not working. :( help

I have this rewrite rule... Redirect all initial request from world.example.com to web.example.com RewriteCond %{HTTP_HOST} ^world\.example\.com$ [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{SERVER_PORT} !^80$ RewriteRule ^(.*)$ https://web.example.com$1 [R=301,L] Which works great. But, s...

1
голосов
1ответов
1299 просмотров

Dynamic URL Rewriting with IIS6

I've been tasked with making an already existing e-commerce site SE friendly - which in this case means (amongst other things) letting the user change the URL for each page/product through the back end. The site is an old asp site running on IIS6. I've started looking into http://www.codeplex.c...

1
голосов
2ответов
1519 просмотров

Rewrite subdomain to subdomain/folder in vhost situation

I'm trying to rewrite abc.example.com/path to abc.example.com/index.php/abc/path using the following .htaccess: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(abc)\.example\.com RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/abc/$...

0
голосов
1ответов
653 просмотров

II7 Rewrite Issues - excluding pages

Hey all, I've got a question about IIS7 rewrite. I'm wondering if there is a way to set conditions for re writing urls. I'm wanting to rewrite: http://www.domain.com/user.aspx?id=username to become http://www.domain.com/username/ I also have ht...

0
голосов
1ответов
1146 просмотров

Zend Framework custom route isn't working at all

I've got a really weird problem with ZF (at least for ZF newbie): I can not access my existing controller and its action method. No problems with: localhost/ localhost/index localhost/index/index localhost/index/about But, I've set route like this: /localhost/test, pointing to index controlle...

0
голосов
1ответов
858 просмотров

Rewrite Route to map to default route

Because of the problems I experienced here: Zend_ Controller_ Router_Exception: “xyz” is not specified I want to have this route: ":module/:controller/:id" and map it onto this: ":module/:controller/:action/id/$id" Is there any possibility to do this with Zend Framework? I do not want to f...