navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Mod Rewrite Help

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Server Issues >> Mod Rewrite Help
Page: [1]
 
mbuna

 

Posts: 1
Joined: 4/12/2004
Status: offline

 
Mod Rewrite Help - 4/12/2004 12:24:19   
Hello,

I have a site on my server that I want to redirect to a new domain.

My initial thoughts are that a rewrite rule would be best. However I'm not familiar with the syntax of this and my attempts so far have all failed.

At first I tried it in the .htaccess file of the site, and then I tried it in the <directory> directive of the server (httpd.conf file).

Can someone give me the mod rewrite statements to redirect all requests for objects in a site to a new domain?

IE:  anything that goes to http://domain1.com/ should now end up at http://domain2.com

EX:  http://domain1.com/index.php   -->  http://domain2.com/index.php
EX:  http://domain1.com/images/banners/test.jpg -->  http://domain2.com/images/banners/test.jpg


etc.

TIA!

< Message edited by mbuna -- 4/12/2004 12:35:39 >
ellipisces

 

Posts: 849
Joined: 12/14/2003
Status: offline

 
RE: Mod Rewrite Help - 4/15/2004 15:23:53   
quote:

The RewriteBase directive explicitly sets the base URL for per-directory rewrites. As you will see below, RewriteRule can be used in per-directory config files (.htaccess). There it will act locally, i.e., the local directory prefix is stripped at this stage of processing and your rewriting rules act only on the remainder. At the end it is automatically added back to the path.

When a substitution occurs for a new URL, this module has to re-inject the URL into the server processing. To be able to do this it needs to know what the corresponding URL-prefix or URL-base is. By default this prefix is the corresponding filepath itself. But at most websites URLs are NOT directly related to physical filename paths, so this assumption will usually be wrong! There you have to use the RewriteBase directive to specify the correct URL-prefix.

Notice: If your webserver's URLs are not directly related to physical file paths, you have to use RewriteBase in every .htaccess files where you want to use RewriteRule directives.

Example:

Assume the following per-directory config file: #
# /abc/def/.htaccess -- per-dir config file for directory /abc/def
# Remember: /abc/def is the physical path of /xyz, i.e., the server
# has a 'Alias /xyz /abc/def' directive e.g.
#

RewriteEngine On

# let the server know that we were reached via /xyz and not
# via the physical path prefix /abc/def
RewriteBase /xyz

# now the rewriting rules
RewriteRule ^oldstuff\.html$ newstuff.html



I would test it in a folder one down from /WWW. It should go in .htaccess. be very careful of your paths. Most servers use the aliases...

< Message edited by ellipisces -- 4/15/2004 12:24:35 >


_____________________________


(in reply to mbuna)
Page:   [1]

All Forums >> Web Development >> Server Issues >> Mod Rewrite Help
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts