Reputation:
I know this is silly question for you but not for me
I am using rdp
for manage my account and somehow I got problem in that
Like I have my portfolio in hthocs/portfolio
folder, now whenever someone visit it, i need like that
example.com
and whenever someone visit htdocs/example
, i need like this
example.com/example
So i only want to redirect homepage folder in my site and other folder behave regularly
I search on internet and I found like that
RedirectMatch ^/$ /portfolio
but using this, its shows correct path like example.com/portfolio
EXAMPLE
Give you example of localhost
,
htdocs
|
|--- portfolio (folder)
|--- stackoverflow (folder)
Whenever I visit localhost
in browser ( internally it will redirect to htdocs/portfolio
) and when I visit localhost/stackoverflow
in browser, It will redirect to htdocs/stackoverflow
not in htdocs/portfolio/stackoveflow
.
using RedirectMatch ^/$ /portfolio
this code, I solved my problem but whenever I visit localhost
, in browser its shows real path localhost/portfolio
. i don't want to client know it will redirect to this folder
I use #
to scroll in website but now when i click on that, it will redirect to original folder
Upvotes: 1
Views: 484
Reputation: 785146
You can use these rules in your site root .htaccess:
RewriteEngine On
# to internally rewrite / to /portfolio
RewriteRule ^$ /portfolio/ [L]
To fix css/js, you can add this just below <head>
tag of your page's HTML:
<base href="/" />
Upvotes: 1