apache - Hide subfolder in URL with .htaccess -
i have url structure this: www.mydomain.com/foo/bar/index
and want achieve this: www.mydomain.com/bar/index
i have rewrite rule remove .php url:
rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(([a-za-z0-9\-]+/)*[a-za-z0-9\-]+)?$ $1.php so, how can add new rule hide foo subfolder in compliance rule implemented?
you can have htaccess one:
rewriteengine on # add /foo/ if not there rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule !^foo/ foo%{request_uri} [l,nc] # add .php rewritecond %{request_filename} !-d rewritecond %{request_filename}.php -f rewriterule ^(.+?)/?$ $1.php [l]
Comments
Post a Comment