user868234
user868234

Reputation: 1

Directory rewrite URL in Apache, htaccess

I urgently need help in rewriting php URLs for my site. I have researched and tried everything but it's still not working.

I want to rewrite all the URLs in my htaccess file to rename the directory '_public' to 'art':

www.site.com/_public/work.php

so all url's show:

www.site.com/art/work.php

Can anyone help? would appreciate it very much.

Upvotes: 0

Views: 2176

Answers (2)

suresh2507
suresh2507

Reputation: 11

Please add below lines in your htaccess file:

RewriteEngine on

RewriteRule ^art/(.+)$ /_public/$1

Upvotes: 1

Joe Bowman
Joe Bowman

Reputation: 504

If I understand correctly, you want the user to go to 'www.site.com/art/work.php' and get the page located at 'www.site.com/_public/work.php' displayed.

In .htaccess (in the root directory) do:

RewriteEngine on

RewriteRule ^art/(.+)$ /_public/$1 [L,QSA]

Upvotes: 3

Related Questions