Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-08-2010, 08:22 AM
gullsinn's Avatar
Contributing Member
Latest Blog:
None

 
Join Date: 06-10-07
Posts: 90
iTrader: 0 / 0%
gullsinn is on the right pathgullsinn is on the right pathgullsinn is on the right path
Send a message via Skype™ to gullsinn
redirect from index.php to root

i need your help please
i need to redirect from
index.ph
index.php?
index.php?/index
as these three URL are have same content and google indexing every listed above separately
so i want them to redirect root directory using .htaccess 301 redirect

thanks
Share |
Reply With Quote
  #2 (permalink)  
Old 03-08-2010, 01:36 PM
Contributing Member
Latest Blog:
None

 
Join Date: 01-16-10
Posts: 78
iTrader: 0 / 0%
Uncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really nice
Code:
Options +FollowSymlinks RewriteEngine on RewriteRule ^index.php?$ /? [R=301]
The regular expression checking for your various index files means -
the file name string
^ (starts with) index.ph p? (followed by an optional p) $ (at the end - nb: query strings aren't matched and are normally automatically appended to the replacement)

The replacement file name string (not a regular expression)
/ (root) ? (discard any query strings)

The switch (not a regular expression)
[R=301] (Redirection - Moved Permanently)

Last edited by Uncle Dog; 03-08-2010 at 01:45 PM. Reason: Clarify, clarify, clarify.
Share |
Reply With Quote
  #3 (permalink)  
Old 03-08-2010, 07:37 PM
gullsinn's Avatar
Contributing Member
Latest Blog:
None

 
Join Date: 06-10-07
Posts: 90
iTrader: 0 / 0%
gullsinn is on the right pathgullsinn is on the right pathgullsinn is on the right path
Send a message via Skype™ to gullsinn
Quote:
PHP Code:
Options +FollowSymlinks
RewriteEngine on
RewriteRule 
^index.php?$ /? [R=301
this redirects every thing back to root so with this no one will be able to surf web
Share |
Reply With Quote
  #4 (permalink)  
Old 03-08-2010, 11:24 PM
Contributing Member
Latest Blog:
None

 
Join Date: 01-16-10
Posts: 78
iTrader: 0 / 0%
Uncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really nice
I tested it, again, and it works.
It redirects

from
index.ph
index.php?
index.php?/index
...to redirect root directory using .htaccess 301 redirect


I appreciate the rep' - Thanks for your help index redirection problem resolved

Why do you think this redirects every thing back to root
How does this mean no one will be able to surf web

Does everything on your site revolve around index.php and a query string?
Share |
Reply With Quote
  #5 (permalink)  
Old 03-08-2010, 11:38 PM
gullsinn's Avatar
Contributing Member
Latest Blog:
None

 
Join Date: 06-10-07
Posts: 90
iTrader: 0 / 0%
gullsinn is on the right pathgullsinn is on the right pathgullsinn is on the right path
Send a message via Skype™ to gullsinn
Uncle yes it was working fine when i put this
but after half an hour when i go back to site it was redirecting all subpages to root

it is because subpages inclueds index.php for example
http://www.kingkoopa.com/index.php?/topic/15-how-to-make-money-on-an-image-host/page__pid__110__st__0&#entry110

Last edited by gullsinn; 03-08-2010 at 11:44 PM.
Share |
Reply With Quote
  #6 (permalink)  
Old 03-09-2010, 02:54 PM
Contributing Member
Latest Blog:
None

 
Join Date: 01-16-10
Posts: 78
iTrader: 0 / 0%
Uncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really niceUncle Dog is just really nice
OK. Try

Code:
Options +FollowSymlinks RewriteEngine on RewriteRule ^index.ph$ / [R] RewriteCond %{QUERY_STRING} !(.+) RewriteRule ^index.php$ /? [R] RewriteCond %{QUERY_STRING} \/index RewriteRule ^index.php$ /? [R]
This will redirect plain index.php to root as well. I don't think that will matter.
Share |
Reply With Quote
  #7 (permalink)  
Old 03-09-2010, 03:43 PM
gullsinn's Avatar
Contributing Member
Latest Blog:
None

 
Join Date: 06-10-07
Posts: 90
iTrader: 0 / 0%
gullsinn is on the right pathgullsinn is on the right pathgullsinn is on the right path
Send a message via Skype™ to gullsinn
Yes
Thanks it works
also for 404 i am using this
PHP Code:
ErrorDocument 404 http://www.example.com/ 
can i make this 301 or this one is just fine

Again Thanks now it is working
Share |
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Submit: root-b.org proxy-listing.com Directory Announcements & Promotions 2 12-08-2008 03:06 AM
The Square Root of 3 chicgeek Forum Lobby 11 05-07-2008 12:34 AM
Max # of files in root Bana Web Design Lobby 2 04-11-2008 04:25 PM
How to redirect index.html to index.php and keep the same positions? sniperhiga SEO Forum 7 04-23-2007 06:51 AM
google index times and inital index? jasonstrempke Google Forum 10 04-24-2006 10:19 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 12:06 PM.
© Copyright 2010 V7 Inc
Powered by vBulletin
Copyright © 2000-2010 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.