URL Rewriting Questions..... Please Help !!!

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
dnmmx
Forum Newbie
Posts: 1
Joined: Mon Apr 02, 2007 6:42 am

URL Rewriting Questions..... Please Help !!!

Post by dnmmx »

Hi all PHP Geeks,

I want to enable URL-Rewriting in My Application
Actually I m a newbie for PHP.

I want to setup URL-Rewriting in a way that

If I write
http://www.site.com/page
then it should become
http://www.site.com/page/

i.e. it should add the slash at the end automatically.
and this should be happen for Every page.

and this should redirected to http://www.site.com/page.php

Please not that I m not having Domain at root, so the

RewriteBase would not be /

I m having Access to the 2nd Directory in Hierarchy. i.e. /MyDir
My Whole site is Contained within that Dir. Itself.
so the RewriteBase would be /MyDir .............Right ??

One More thing if I am Having .htaccess file at the root level and not in my directory /MyDir
does it make any diff. in writing the RewriteRule ??

As u can see I don't have any querystrings in URL, but I just want to make the URLs CLEAN
and easily Memorable.

Second, I have directory structure in my site so my URL can be like,

http://www.site.com/directory/folder/page/
this should be redirected to the page
http://www.site.com/directory/folder/page.php

I hope I make myself clear

I have tried alot but I don't have enough knowledge of RegEx, So can't do that properly.
Hope I'll find the Answer from Here.
Please Help me in writing appropriate Snippets in .htaccess file

Thanks in Advance
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Why would it even need an ending forward slash? Have you researched what your directory structure will end up looking if you format it that way?
Post Reply