Reputation: 49
I have looked all over for the answer but can't seem to get any examples working so I need some help.
I have a website built in PHP (Not using a framework).
I have sub-pages in a folder called /some-work/
So the address to these sub pages is www.domain.co.uk/some-work/page
I want to be able to access this pages by
www.domain.co.uk/page.
Everything I have tried has caused it to change the url in the address but not actually display the page.
Can someone please help?
Upvotes: 1
Views: 50
Reputation: 786146
You can use this rule in root .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?!some-work/).*)$ some-work/$1 [L,NC]
Upvotes: 1
Reputation: 41249
Try this in your Public_html/.htaccess :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ /some-work/$1 [L,NC]
Upvotes: 0