Reputation: 3
I have a php script on a webserver. Currently, the script is being accessed as http://www.mydomain.com/scriptname.php
.
Is there a way i can create a user friendly url for accessing this script, something like http://www.mydomain.com/appname,
so when this url is called it invokes the php script ?
Please help. Thank You
Upvotes: 0
Views: 455
Reputation: 8268
Using the default settings of most PHP hosts, you can put the file "index.php" inside your folder http://www.mydomain.com/appname, then fill the index.php with next code:
<?php header("location: http://www.mydomain.com/scriptname.php"); ?>
That would do it.
Upvotes: -1
Reputation: 44752
If you don't have access to your apache/lighttpd configuration file a little hack that may work is putting the script in http://www.mydomain.com/appname/index.php
; http://www.mydomain.com/appname/
will then probably work.
Upvotes: 3
Reputation: 8480
You want mod_rewrite if you're using Apache HTTPD: http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
If you're using a different web server, it may have something similar (lighttpd has a similar functionality builtin).
Once it's enabled, you can use something like this in your .htaccess file to rewrite appname to scriptname.php
RewriteEngine on
RewriteRule ^appname$ scriptname.php
Upvotes: 8