I want to move from www.example.com/_/randomfolder
to example.com/randomfolder
. It should acces the contents from /_/randomfolder
but should show example.com/randomfolder
.
What I have tried:
Trial 1
RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$ 1 [R=301,L,QSA] RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Problem: it full fills my requirement from /_/randomfolder
but should show example.com/randomfolder
but affects my main domain example.com
it shows nothing, only a 404 page. I want it to show public_html/index.php
only.
Trial 2:
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #To load site from /_/xyz to /xyz without hcanigng url RewriteRule ^[A-Za-z0-9._]+ /_/%{REQUEST_URI} [L]
Problem: I have to manually change the address bar from www.example.com/_/randomfolder
to example.com/randomfolder
, it load contents with or without _
but on first time load its redirects to /_/random folder
.