Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.htaccess
10-24-2013, 08:00 AM,
Post: #1
.htaccess
any body knows how to rewrite dcms /info.php=id1 to /username
Reply
10-27-2013, 11:31 AM, (This post was last modified: 10-28-2013, 09:56 AM by ionutvmi.)
Post: #2
RE: .htaccess
The logic of it is pretty simple so let's take it step by step

First you need to redirect site/username -> user.php?name=username
So in your htaccess
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ user.php?name=$1 [L,QSA]

then you need to check the username you received in user.php
so in your php page
PHP Code:
$username  $_GET['name']; // the username for the url
// check if the username is in your database 
// ... verification code here
if(isValidUser()) {
     
//show the profile page for that user.
} else {
    
// redirect to the home page
    
header("Location: /index.php");


Hope it helps and you got the idea.
Reply
11-05-2013, 07:26 PM,
Post: #3
RE: .htaccess
simple
Reply
02-14-2014, 03:49 AM,
Post: #4
RE: .htaccess
tankz
Reply
05-25-2016, 07:58 PM, (This post was last modified: 05-25-2016, 07:59 PM by zonestc1.)
Post: #5
RE: .htaccess
Hi

أرسلت من GT-I9301I الخاص بي

(05-25-2016, 07:58 PM)zonestc1 Wrote: Hi

أرسلت من GT-I9301I الخاص بي
Xvidio

أرسلت من GT-I9301I الخاص بي
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)