Discussion:
Htaccess file for redirect?
(too old to reply)
Andrew S
2012-09-16 22:49:24 UTC
Permalink
Hello cool people,
We had two web sites on the one server and the second web site has got so
big we need to move it to its own server.

So we setup the second web server and copied all the files to it, so
effectively the web site has moved from:
www.firstwebsite.com/subdirectory/index.html
to
www.newwebsite.com/index.html
- note that it is no longer in a sub directory.

So, going from the advice page:
http://httpd.apache.org/docs/2.4/rewrite/remapping.html
should I follow the "Resource Moved to Another Server" instructions?

Supposedly I have to edit a '.htaccess' file, but I don't know where it is
located on the server. Where should it be? In the default public_html or
www folder or in one of the server folders?

So I need to redirect 5 URLs. How do I do that? How about this:

(with htaccess on first server)

#With mod_rewrite
RewriteEngine on
RewriteRule ^/subdir/(.*) http://www.newwebsite.com/$1 [R,L]

Is that last bit correct? Is there anything else I need, like to do I need
to close that statement? Thanks a lot.
Cheers, Andrew
Ivan Shmakov
2012-09-21 04:17:30 UTC
Permalink
[Cross-posting to news:comp.infosystems.www.servers.misc.]

[...]
Post by Andrew S
Supposedly I have to edit a '.htaccess' file, but I don't know where
it is located on the server. Where should it be? In the default
public_html or www folder or in one of the server folders?
The directory the site files are located in.
Post by Andrew S
(with htaccess on first server)
#With mod_rewrite
RewriteEngine on
RewriteRule ^/subdir/(.*) http://www.newwebsite.com/$1 [R,L]
Is that last bit correct? Is there anything else I need, like to do
I need to close that statement?
As stated, this problem could be solved by a RedirectMatch [1]
directive, like:

## with mod_alias
RedirectMatch permanent ^/example/(.*) http://example.com/$1

[1] http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch
--
FSF associate member #7257
Continue reading on narkive:
Loading...