English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Im very experienced in PHP and know some asp. But ive never coem across how to do this. I want it so when a user signs up to my aite a file is created on my site of which its name is their username. This way they can view there "profile" by typing in mysite.com/FILENAME.php.
Doe anyone know how to do this?

2006-09-30 01:53:03 · 5 answers · asked by peter s 1 in Computers & Internet Programming & Design

5 answers

This has nothing to do with PHP; it is strictly a system administration task.

Normally, this is handled using URL rewriting. For example, if the server receives a request for

mysite.com/someuser

it actually displays, say,

mysite.com/profile.php?user=someuser

The user still sees mysite.com/someuser in the address bar, as this is a rewrite rather than redirection.

To use URL rewriting, you need Apache with mod_rewrite enabled.

2006-10-03 06:53:28 · answer #1 · answered by NC 7 · 0 0

Sometimes web hosts do not give you full control of your web site so modifying Apache is not always possible. Wouldn't being able to leave off the .php be better. Such as:

http://mySite.com/JamesDean

Since the page does not exist, the e404html page will be called. Redirect to e404.php and parse the URL and see if JamesDean is a member, if so redirect again to Jimmy's page, if not then it really is a e404 error and handle appropriately.

2006-09-30 02:42:39 · answer #2 · answered by fwiiw 4 · 0 0

One way is to use Apache URL rewriting rules, so requests are redirected to one PHP script with the name as a parameter.

The other is to use a slightly different URL scheme, e.g. example.org/?username (note the ? ) which would pass the username to index.php , and have the advantage that if you switched later to (say) a Ruby on Rails backend, the URLs won't change.

2006-09-30 02:00:26 · answer #3 · answered by kirun 6 · 0 0

Server rules should work

You should be able to set what files are interpreted as php so you could do something like

mysite.com/your.name/FILENAME

If you have Linix/Unix server you can create .htaccess file to interpret .name files with this declaration

AddType application/x-httpd-php .name

Here is a tutorial

http://www.translatum.gr/forum/index.php/topic,824.0.html

If you are on a virtual server or shared host you may or may not be able to do this

Another way to do it is as a rewrite rule:

RewriteEngine on
RewriteRule ^name/.+$ /name.php?filename=$1

for something like

mysite.com/name/FILENAME

will be taken to

mysite.com/name.php? filename=FILENAME

2006-10-01 23:11:25 · answer #4 · answered by dt01pqt_pt 2 · 0 0

in case you're touching on the fortress element....then yeah thats wonderful. yet its not you, and technically to be interior of all criminal limits you will desire to credit the region you purchased it from, even nonetheless it rather shouldnt be a difficulty.

2016-10-15 09:08:50 · answer #5 · answered by Anonymous · 0 0

fedest.com, questions and answers