Jump to content

manipulating the url


Trium918

Recommended Posts

I don't think it is possible since the urls last identifier is the file your executing script from. If you really want to show the name/number:

<?php
<a href='www.mysite/profile/index.php?user=$userNameID'>Link On Previous Page</a>
//URL will look something like: www.mysite/profile/index.php?user=Blackcell
//or
//URL will look something like: www.mysite/profile/index.php?user=05812
?>

Make all of your links look like that. But this can be a security issue if not careful with the information you are passing. If you absolutely want to replace index.php with the name you will have to get into templates and then start with file opening functions and file_exist functions.

Link to comment
https://forums.phpfreaks.com/topic/104625-manipulating-the-url/#findComment-535497
Share on other sites

I don't think it is possible since the urls last identifier is the file your executing script from. If you really want to show the name/number:

<?php
<a href='www.mysite/profile/index.php?user=$userNameID'>Link On Previous Page</a>
//URL will look something like: www.mysite/profile/index.php?user=Blackcell
//or
//URL will look something like: www.mysite/profile/index.php?user=05812
?>

Make all of your links look like that. But this can be a security issue if not careful with the information you are passing. If you absolutely want to replace index.php with the name you will have to get into templates and then start with file opening functions and file_exist functions.

 

I've seen it done on other sites, so I started wondering how could it be done using php.

Link to comment
https://forums.phpfreaks.com/topic/104625-manipulating-the-url/#findComment-535549
Share on other sites

<IfModule mod_rewrite.c>

RewriteEngine On

</IfModule>

RewriteRule ^profile/([a-zA-Z0-9])$ profile.php?username=$1

RewriteRule ^profile/([a-zA-Z0-9])/$ profile.php?username=$1

 

 

Put that in a .htaccess file of your root server directory, and replace profile.php with your profile page name. =P

Link to comment
https://forums.phpfreaks.com/topic/104625-manipulating-the-url/#findComment-535563
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.