Forum Moderators: phranque

Message Too Old, No Replies

Rewriting www.mysite.com/forums/portal.php to simply www.mysite.com

anyone know a simple rule for this? Thanks!

         

DynamicNiches

6:44 pm on Jun 14, 2006 (gmt 0)

10+ Year Member



On one of my forums I have a portal integrated with phpbb as my index home page.

If you type in the basic domain URL (www.website.com) you will end up at (www.mysite.com/forums/portal.php) as the index page.

I still want to use portal.php as my index page but I want to use a command in .htaccess that will automatically cut off the "/forums/portal.php" part so whenever I type in www.mysite.com that it displays www.mysite.com in the browser window instead of www.mysite.com/forums/portal.php

I already have the following command inside my /forums directory's .htaccess file.
DirectoryIndex portal.php index.php

Remember my portal page is in my forums directory and not my main directory. I am currently using a php redirect to redirect to my portal page. The php redirect (index.php) is located in my main directory. Is there a mod_rewrite rule for doing this?

To conclude - I simply am looking for a rule that will rewrite www.mysite.com/forums/portal.php to www.mysite.com

Thanks - all your help is greatly appreciated. :-)

Brett_Tabke

1:13 pm on Jun 15, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



RewriteRule ^forum([0-9]+)/index\.htm$ forum.cgi?forum=$1 [T=application/x-httpd-cgi]

That, transforms:

This:
[webmasterworld.com...]

Into this:
[webmasterworld.com...]

follow?

A simple mod of that could work for you, but it sounds like to me, that you already have other stuff going on.

If you already have a DirectoryIndex line, then you should be showing your root without the "/forums/portal.php" part already.

Which leads me to conclude, that there must be another redirect going on there already after someone requests your root page.

In that case, I don't think a rewrite rule is going to get you the transparency that you are after in the browser.

I would use a header checker, and see what your website is putting out during a request.

Get something like Proxomitron and turn on the logging feature. That will follow a chain of requests through and you can see what your website is putting out. If there is a hard redirect, you would want to deal with that before you deal with any rewrite rules.