LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-10-2015, 09:51 AM   #1
nithinbp
LQ Newbie
 
Registered: May 2015
Posts: 6

Rep: Reputation: Disabled
301 redirection


Hi,

I would like to 301 redirect all sub urls of my domain containing 'dot' to my main website URL.

For example:

Say my domain is redirecttestdm.com.

I need to redirect links like :
http://redirecttestdm.com/testing/2935/asp.netserver
http://redirecttestdm.com/testing/29...-in-b.e-b.tech

to: http://redirecttestdm.com

Please help.
 
Old 08-10-2015, 05:31 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,900

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
You may try this:
Code:
RewriteEngine on

RewriteCond %{REQUEST_URI} \.(.+)
RewriteRule .* http://redirecttestdm.com. [R=301]
Regards
 
Old 08-19-2015, 06:26 AM   #3
nithinbp
LQ Newbie
 
Registered: May 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks Bathory. It worked.

I have another doubt. Is it possible to do a 301 redirection for all pages which is having a soft 404 error.

ie, the page exists but the content removed.
 
Old 08-19-2015, 08:06 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,900

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
Quote:
Originally Posted by nithinbp View Post
Thanks Bathory. It worked.

I have another doubt. Is it possible to do a 301 redirection for all pages which is having a soft 404 error.

ie, the page exists but the content removed.
If the file in question has a 0 byte size, you can use:
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule .* http://redirecttestdm.com [R=301]
 
Old 08-19-2015, 08:28 AM   #5
nithinbp
LQ Newbie
 
Registered: May 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
should i use 301 redirect or not? MeghanClaire Linux - Newbie 2 06-20-2015 04:37 AM
[SOLVED] Update to Linux 3.11.10-301 phillyfilly Linux - Newbie 2 02-11-2014 07:12 PM
301 not working wilkos73 Linux - Newbie 5 12-06-2012 05:36 PM
which file did the permanent redirection (301)? aclhkaclhk Linux - Server 1 12-31-2010 05:59 AM
Skytone RST-301 oddiofile Linux - Hardware 1 08-25-2008 03:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration