Top Hosting Forum

WebHosting Reviews Forum


Budget DirectAdmin hosting and domain names

3 htaccess redirects - all subpages to one page, new domain

Website Development is a general forum for Website Development related issues including questions on codes such as PHP, HTML and Javascript
Hosting Forum Description
Website Development is a general forum for Website Development related issues including questions on codes such as PHP, HTML and Javascript

3 htaccess redirects - all subpages to one page, new domain

Postby hostingforum » Wed Mar 06, 2013 11:28 am

Hi, if you dont know how to use mod rewrite, you need to search over and over again manuals.
Im confortable more in searching than investing my time, what about You?

So here is the command to redirect all subpages of a domain to one page

RewriteEngine On
RewriteCond %{REQUEST_URI} !=/index.php
RewriteRule .* /index.php

you can choose any other file instead of homepage (index.php)

Add these above 3 lines into your .htaccess file (yourdomain.tld/.htaccess)

---------------------------

If you need to redirect all subpages to another new domain while retaining subpage address, (htaccess old domain to new domain), You can use this command in your htaccess:

RedirectMatch 301 (.*) http://yournewdomain.com$1

Downside of above redirect: it will redirect yourOLDdomain.com/somesubpage to yourNEWdomain.com/somesubpage

---------------------------

If you need to redirect yourNEWdomain.com/somesubpage to yourNEWdomain.com do this htaccess command:

RedirectMatch 301 / http://yournewdomain.com


:hand



Ad: There You can have your forum site-wide banner/text ad for $99 yearly. Contact admin


Top Hosting Forum - Welcome
Gtalk: mercedesslr1, Skype: suprman41, YM: Brothercz, ONLINE CHAT
User avatar
hostingforum
Site Admin
 
Posts: 656
Joined: Fri May 20, 2011 7:58 pm
Location: Czech Republic

Return to General Website Development & Programming

Who is online

Users browsing this forum: No registered users and 0 guests

.

cron