Hi All,

I am trying to rewrite the URL
http://www.example.com.br/folder/sub_folder/my_profile.php to
http://www.example.com.br/folder/my-profile.
I have tried lot of rewrite method but i can’t redirect the URL.

Please anyone help to solve this.

Member Avatar
diafol

In your folder directory you can have the .htaccess file:

RewriteEngine On
RewriteRule ^([^/]*)/*$ sub_folder/$1\.php [L]
RewriteCond $1 !^sub_folder
RewriteRule ^(.*) sub_folder/$1 [L] 

Note this is NOT a redirect. You can use:

http://www.example.com.br/folder/sub_folder/my_profile.php
OR
http://www.example.com.br/folder/my_profile

Both will access the same page.
With regard to underscores - I may get back to you. I'm a rewrite noob so - anybody else?