Apache RewriteEngine questions

Associate
Joined
18 Feb 2003
Posts
477
Location
Moscow
I have a small problem with a client I've just started working for. I've got myself a copy of the site for my local machine but all the URIs are wrong. The URIs all have a / in front of them meaning they are not local to my machine. Is there anyway using a .htaccess file and the RewriteEngine to fix this short of going through every file? An example follows:

What I have:

Code:
<?php virtual("/doctype.htm");?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>A Company</title>
<style type="text/css">@import "/style.css";</style>
<link rel="stylesheet" href="/style.css" type="text/css" media="print" />
<script type="text/javascript" src="/js.js"></script>
</head>

What I want:

Code:
<?php virtual("doctype.htm");?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>A Company</title>
<style type="text/css">@import "style.css";</style>
<link rel="stylesheet" href="style.css" type="text/css" media="print" />
<script type="text/javascript" src="js.js"></script>
</head>

As you can see this affects PHP includes and the XHTML.
 
Man of Honour
Joined
31 Jan 2004
Posts
16,335
Location
Plymouth
Assuming you have Apache setup, add a VirtualHost for the domain and edit your Windows hosts file to point the domain to 127.0.0.1 - c:\windows\system32\drivers\etc\hosts (it's a text file, no extension) :)
 
Back
Top Bottom