Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove folder names from the URL using htaccess

I am stuck in here with htaccess. I've searched and tried many tutorials and problem solutions but couldn't achieve what I want.

I want to remove folder names from the website link. My htaccess file is in the root directory i.e "testing"

What my link looks like:

http://localhost/testing/sub/test.php

What I want:

http://localhost/test.php

Following is my htaccess

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule /(.*) /testing/sub/$1    [L]
like image 671
Zain SMJ Avatar asked Apr 07 '26 12:04

Zain SMJ


1 Answers

Use this line in your root .htaccess

RewriteRule ^test.php$ /testing/sub/test.php

like image 182
Adeel Sheikh Avatar answered Apr 09 '26 00:04

Adeel Sheikh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!