Jump to content

Recommended Posts

okay

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule (.*)/$ $1 [R,L]
RewriteRule ^([a-zA-Z0-9_-]+)$ $1\.php [L,QSA]

Options +FollowSymLinks
RewriteRule profile-(.*)$ profile.php?username=$1					
								

now the links is: www.mysite.com/profile-abc

Edited by KhaledBawz

Hey @KhaledBawz,

 

not too much time today but when I ran your script I've got a fake result:

Array
(
    [username] => jazzman.php
)

But, userName is just jazzman, not jazzman.php, right?

 

Secondly, what about if you have inheritance in your files, so one URL goes to second then goes to third and so on?

 

Anyway, I am glad to see that you sorted out this issue.

 

Have a nice day,

 

jazz.

about the fake result I just fixed now, I didn't notice it last time

RewriteEngine On
 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^/?([a-z]+)$ $1.php [L]

Options +FollowSymLinks
RewriteRule profile-(.*)$ profile.php?username=$1					
								

all links is working fine, no any duplicated in path :) thank you jaz I appreciate your help

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.