Forum Moderators: phranque

Message Too Old, No Replies

RewriteRule for two home pages

Clean url's issue

         

Tenko

7:38 pm on Apr 16, 2012 (gmt 0)

10+ Year Member



Hi everyone.

Please could someone help to point us in the right direction.

We've recently installed forum software and wordpress in the same directory and renamed the blog's index.php page to blog.php and at the very top of the htaccess file we have, DirectoryIndex blog.php index.php so wordpress opens first.

All went well but we're having a tough time getting clean url's for SEO purposes.

We can either have clean url's for the forum's index.php or the permalinks working on wordpress but sadly we cant find a way to have both.

I'm very new to this side but understand that which ever RewriteRule we declare first out of blog.php or index.php seems to work great but sadly we cant find a way for both to be read, at present the second one just produces a 404.

Sincere apologies for my lack of knowledge and understanding on this issue but would anybody be able to point us in the right direction to how we can have both index and blog.php working so the forum has clean url's and the permalinks work on wordpress.

g1smd

9:07 pm on Apr 16, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The only way to do this is if the requested URL includes a clue that you can program into the RegEx pattern so that this or the other RewriteRule deals with this request. That clue is usually a folder name in the URL for one or other of your two systems. That's the ideal.

In this case you'll probably list the Wordpress RewriteRule first and instead of using (.*) to capture all requests you'll use a more specific pattern to capture WP permalink requests.

Tenko

9:25 pm on Apr 16, 2012 (gmt 0)

10+ Year Member



Hi, thanks for the reply and the advice.

If we created something like /wp/ for the wordpress permalinks, would it be possible for a way to not display the /wp/ in the url so the wordpress url's would still look as they were coming direct from the root folder?

Many thanks once again.

g1smd

9:44 pm on Apr 16, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No.

That's the whole point. There needs to be something in the URL that users see and use in order for the WP rewrite rule to intercept that URL request and deal with it, instead of letting the other rewrite rule service the request.

Mod_rewrite does not "make" URLs. It responds to URL requests after a link on a page is clicked.

Tenko

9:53 pm on Apr 16, 2012 (gmt 0)

10+ Year Member



Ahh ok. Many thanks for that.

lucy24

10:36 pm on Apr 16, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is a subdomain a possibility? On one hand is www.example.com, on the other is forums.example.com. Or blogs.example.com-- your choice. This of course has no relationship to where the content "really" lives, but it definitely makes for unambiguous URLs.