Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-27-2007, 07:45 AM
mantawebsolutions's Avatar
WebProWorld Veteran
 

Join Date: Jun 2004
Location: Pretoria, South Africa
Posts: 306
mantawebsolutions RepRank 0
Default Combining my .htaccess rewrites with WordPress rewrites

I am just having a bit of a problem and hope someone can help me. I have to sketch a scenario for you to understand.

My standard .htaccess on my site mantaseosolutions.com looks like this
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.php? [NC]
RewriteRule ^(([^/]*/)*)index\.php?$ http://www.mantaseosolutions.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^mantawebsolutions.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mantawebsolutions.com$ [OR]
RewriteCond %{HTTP_HOST} ^mantaseosolutions.com$
RewriteRule ^(.*)$ http://www.mantaseosolutions.com/$1 [R=301,L]

Redirect 301 /contactus.php http://www.mantaseosolutions.com/contactus/index.php
Redirect 301 /newsroom.php http://www.mantaseosolutions.com/news/index.php

ErrorDocument 404 http://www.mantaseosolutions.com

This works a 100% for my site. I have now added a WordPress blog to my site under the /blog/ folder and want to redirect all my old news pages (previously under /news/ folder) to the new location on the blog.

In my new /blog/ folder I am using the WordPress rewrite in a seperate .htaccess file saved in this particular folder as follow:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

I cannot figure out how to correctly set up my two .htaccess files (or combine them) to give me what i want.

I want to redirect all my old posts under the /news/ folder to the new post under /blog/ but this does not happen.

Example:
http://www.mantaseosolutions.com/news/news.php?id=31 must redirect to http://www.mantaseosolutions.com/blo...ark-completed/

Can anyone help ?
Reply With Quote
  #2 (permalink)  
Old 03-27-2007, 05:05 PM
incrediblehelp's Avatar
Moderator
WebProWorld Moderator
 

Join Date: Jan 2004
Location: Live in Cincy Now
Posts: 7,702
incrediblehelp RepRank 4incrediblehelp RepRank 4incrediblehelp RepRank 4incrediblehelp RepRank 4
Default

How are you editing this file? You may be adding extra characters (on accident) that might be messing it up.
Reply With Quote
  #3 (permalink)  
Old 03-28-2007, 02:58 AM
mantawebsolutions's Avatar
WebProWorld Veteran
 

Join Date: Jun 2004
Location: Pretoria, South Africa
Posts: 306
mantawebsolutions RepRank 0
Default

incredible, thanks, but i don't think it's that. i am using PHP designer to do my editing, but i could just as well have used Homesite+ or Notepad. I am pretty sure there are now extra characters.

the problem is not that my .htaccess file don't work. it's a case of the one is ignoring some conditions while the other is overuling them.

the .htaccess file for my site is doing what it is supposed to do. eg: http://www.mantaseosolutions.com/contactus.php does redirect to http://www.mantaseosolutions.com/contactus/index.php

and http://www.mantaseosolutions.com/wrongpage/ does go to the homepage (no 404 page)

but when I want to redirect http://www.mantaseosolutions.com/news/news.php?id=31 to http://www.mantaseosolutions.com/blo...ark-completed/, it also simply goes to the homepage and not to the new page in the /blog/ folder. It seems the WordPress RewriteCond tells it something different.

There is perhaps something small I am missing - can't figure out what tho...
Reply With Quote
  #4 (permalink)  
Old 04-04-2007, 06:15 PM
incrediblehelp's Avatar
Moderator
WebProWorld Moderator
 

Join Date: Jan 2004
Location: Live in Cincy Now
Posts: 7,702
incrediblehelp RepRank 4incrediblehelp RepRank 4incrediblehelp RepRank 4incrediblehelp RepRank 4
Default

manta you find out what was happening?
Reply With Quote
  #5 (permalink)  
Old 04-05-2007, 03:43 AM
mantawebsolutions's Avatar
WebProWorld Veteran
 

Join Date: Jun 2004
Location: Pretoria, South Africa
Posts: 306
mantawebsolutions RepRank 0
Default

Jaan, not really, no. I think it has to do with the rewrites for the blog itself, but i cannot be sure, so what i've done was to keep the two sections seperate. One .htaccess file for my site and one .htaccess file for my blog.

So both work independantly from each other but it still does not solve my redirect issue for http://www.mantaseosolutions.com/news/news.php?id=31 that should redirect to http://www.mantaseosolutions.com/blo...ark-completed/

I will tackle this again in a few days, when I geet through all my client work... (can you believe that i just said that???)
Reply With Quote
  #6 (permalink)  
Old 04-05-2007, 03:46 AM
incrediblehelp's Avatar
Moderator
WebProWorld Moderator
 

Join Date: Jan 2004
Location: Live in Cincy Now
Posts: 7,702
incrediblehelp RepRank 4incrediblehelp RepRank 4incrediblehelp RepRank 4incrediblehelp RepRank 4
Default

Yeah I have been slammed of late to, back to work or sleep :(
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , , ,



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0