| | |
htaccess: Redirect all pages including subdomain to index.
Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hi,
I am trying to write a .htaccess script that can redirect any URL on my site (whether it exists or not, including sub-domains) to the index page of that site.
For example:
example.com/pages/page.htm ---> example.com
sub.example.com/page.htm ---> example.com
error.example.com/error ---> example.com
I've tried a few things with mod_rewrite but I can't seem to get existing urls, non-existing urls and sub domain urls to all direct to the index page.
Thanks,
Martin
I am trying to write a .htaccess script that can redirect any URL on my site (whether it exists or not, including sub-domains) to the index page of that site.
For example:
example.com/pages/page.htm ---> example.com
sub.example.com/page.htm ---> example.com
error.example.com/error ---> example.com
I've tried a few things with mod_rewrite but I can't seem to get existing urls, non-existing urls and sub domain urls to all direct to the index page.
Thanks,
Martin
Last edited by martinkorner; Sep 17th, 2009 at 2:10 pm.
•
•
•
•
Hi,
I am trying to write a .htaccess script that can redirect any URL on my site (whether it exists or not, including sub-domains) to the index page of that site.
For example:
example.com/pages/page.htm ---> example.com
sub.example.com/page.htm ---> example.com
error.example.com/error ---> example.com
I've tried a few things with mod_rewrite but I can't seem to get existing urls, non-existing urls and sub domain urls to all direct to the index page.
Thanks,
Martin
try this:
RSS, Web Services and SOAP Syntax (Toggle Plain Text)
RewriteEngine On RewriteCond %{REQUEST_URI} !=/index.php RewriteRule .* /index.php
![]() |
Similar Threads
- Need a 301 redirect script for php to html (PHP)
- .htaccess redirect for subdomain (*nix Software)
- Cannot redirect webpage after removing "index.php" from url (JavaScript / DHTML / AJAX)
- asp redirect problem (ASP)
- Redirect (ASP)
- 301 redirect on a non-aspx page? (ASP.NET)
- on links and possibly .htaccess (Existing Scripts)
- Bots & .htaccess (Search Engine Optimization)
- Apache mod_rewrite with Google Ads (Linux Servers and Apache)
- How do I Mod Rewrite when I got a subdomain? (Linux Servers and Apache)
Other Threads in the RSS, Web Services and SOAP Forum
- Previous Thread: WSDL not working (web service)
- Next Thread: putting executable file on a webpage
Views: 2187 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for .htaccess, 301, htaccess, redirect







