Forum Moderators: coopster

Message Too Old, No Replies

Changing URL to point to PHP script?

Want PHP to load on main page.

         

BigAl

6:00 am on Oct 12, 2005 (gmt 0)

10+ Year Member



Hi,

My main page on my site has a php script on it. Right now my URL looks like this. WWW.MYSITENAME.COM/search/search.php I want that page to show when you type in my URL WWW.MYSITENAME.COM. I don't want my whole site to be cloaked only that directory. Any ideas how I can do this? There must be a couple ways to do it?

omoutop

9:11 am on Oct 12, 2005 (gmt 0)

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



hi BigAl,
u can do that by using .htaccess and the command permanent redirection....this is an example:

RedirectPermanent index.htm [MYSITENAME.COM...]

BigAl

11:24 am on Oct 12, 2005 (gmt 0)

10+ Year Member



Great, thanks! I'm not sure how to edit the .htaccess file yet but I'll figure it out.

omoutop

11:45 am on Oct 12, 2005 (gmt 0)

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



your .htaccess file should be placed within the root of your web folder (probably public_html or something like that)....u just need this line I gave u as long as I know...if u have problems just post again and we will figure it out..

BigAl

1:02 pm on Oct 12, 2005 (gmt 0)

10+ Year Member



Hmm, not working. I even went and read a couple htaccess tutorials on the redirect permanent with no luck. I even tried all kinds of variations hoping to to figure it out by process of elimination.

Here is what my htaccess file looks like now:

# -FrontPage-

IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.MY-URL.com
AuthUserFile /home/myusername/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/myusername/public_html/_vti_pvt/service.grp
Redirect permanent /search/search.php [MY-URL.com...]

BigAl

1:09 pm on Oct 12, 2005 (gmt 0)

10+ Year Member



COOL, Never mind. I figured it out. THANKS! Just one last question. Now when I type in my URL WWW.MY-URL.COM it forwards it to WWW.MY-URL.COM/search/search.php is there any way to hide the directory so it just says WWW.MY-URL.COM?

Thanks,

# -FrontPage-

IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.my-url.com
AuthUserFile /home/myusername/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/myusername/public_html/_vti_pvt/service.grp
Redirect permanent /index.htm [my-url.com...]

omoutop

1:22 pm on Oct 12, 2005 (gmt 0)

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



yeap! u can still do it by using .htaccess
it should be something like that:

RewriteRule ^WWW.MY-URL.COM/search/search.php$ WWW.MY-URL.COM [nc]

that way when someone types WWW.MY-URL.COM he views WWW.MY-URL.COM/search/search.php

the rule might also be:

RewriteRule ^/search/search.php$ index.html[nc]

hope the best

BigAl

2:31 pm on Oct 12, 2005 (gmt 0)

10+ Year Member



Thanks,

I couldn't get the RewriteRule to work though. I tried both variations you suggested. I searched the forum for other examples but they all seem way more complicated than my simple RewriteRule. I even added "RewriteEngine on" to the line above hoping that would do it.

Any other suggestions?