php - Omit folder name from browser URL via htaccess -


i using shared hosting, linux, cpanel, low-end account, no shell access.

i wish have website, http://example.com, located entirely inside subfolder, this:

/public_html/sub/example 

at moment, using following .htaccess code redirect visitors folder:

rewriteengine on rewritecond %{http_host} ^(www.)?example.com$ rewritecond %{request_uri} !^/sub/mainsite/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /sub/mainsite/$1 rewritecond %{http_host} ^(www.)?example.com$ rewriterule ^(/)?$ sub/mainsite/index.php [l] 

the problem uri displayed in address bar reflects this:

example.com/sub/mainsite/ 

i address bar this:

example.com  example.com/anotherpage   // <--- .php extension removed 

how can using .htaccess?

do need second .htaccess file inside /sub/mainsite folder? say?


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -