rewrite

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/$1 [L] The situation is: domain www.e...

Git, edit root commit for all branches

I have to rewrite the history of my repository because it contains some credentials. As I have to amend the root commit I followed the instructions from Git Faq. My problem is though that I have two branches and several tags already in the repository and I'd like that my history rewrite to apply to those too. The repo isn't public yet, s...

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.com/IIRF and http://www.helicontech.com/isa...

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, some of my applications has... https://wor...

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 it and it would cost about the same of opt...

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 am concerned about performance with that ...

.htaccess rewriting

When I use URL rewrite styles my scripts are rewritten too. How can I fix this? For example, I have redirection /contact/ /index.php?page=contact, css and script files style and scripts folder, so I want style/layout.css to still be readable by my program after a redirect. ...

WebForms / MVC to a Windows Forms programmer

Hi, 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 version was using .NET 1.1. There are l...

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

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

Redirect pages from old to new site - one by one

Hi, 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.html ...and so on. Every old page w...

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 accessed, file.php is called. When new.htm is a...

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. Can someone help me out here? ...

.htaccess rewrite rule

Hi, 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 from /root/projectname/ ? Right now I ...

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 of sites are working in this way. I wonder...

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_HOST}" pattern="^mydomain.co.uk$" /> </conditions> <action type="Rew...

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? <VirtualHost *:80> ... ...

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

Hello, 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 X and then output the results to ...

Rewrite rule cookie problem in apache

Im using a mod_rewrite rewrite rule in apache to get access to a tomcat application. This applications is using session cookies. The application cookies works fine when accessing the tomcat application directly, but if I use the apache url, the cookie will not be sent out by the client browser. I guess this is because there is no match ...

[EZPublish] Removing index.php from URL but keep old links working

Hi all, 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 to find a fix for this in using ...

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

Hello, 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() ...