htaccess code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jodeti
Forum Newbie
Posts: 14
Joined: Tue Apr 28, 2009 8:54 am

htaccess code

Post by jodeti »

Hi,
I want to make my php based script's url search engin friendly,as i know
nothing about .htaccess, can anyone one hints me about the code in the .htaccess

http://127.0.0.1/one/index?base=one&script=comment

ignore 127.0.0.1/one/

the actual url is index?default&base=one&script=comment where "one" is the folder name and comment
is the script on that folder.default is fixed all time. so those url parse in a functin and base and script variable i caught via request in a file which inlude in the very begining of the execution.

So suppose i want visitor to type
http://127.0.0.1/one/comment
but it's actual url is
http://127.0.0.1/one/index?base=one&script=comment

and another one like

http://127.0.0.1/one/profile

but it's actual url is

http://127.0.0.1/one/index?base=system&script=profile

can anyone hinst me about the htaccess code for this along with the regular expression

thank you.
jodeti
Forum Newbie
Posts: 14
Joined: Tue Apr 28, 2009 8:54 am

Re: htaccess code

Post by jodeti »

anybody
i think it should be a little bit code
if not just need some hints.
thank you anyway.
solid
Forum Commoner
Posts: 28
Joined: Wed Aug 12, 2009 11:56 am

Re: htaccess code

Post by solid »

.htaccess:

Code: Select all

RewriteEngine on
RewriteRule ^(.+)/(.+)$ index.php?base=$1&script=$2 [L]
Make sure that Apache has "mod_rewrite" enabled, and that your directory has: "AllowOverride all"

You can google the words in quotes for more info :)
Post Reply