I have a website like www.abc.com/service/page.php?ids=social. I redirected site to www.abc.com/service/social. But i need to avoid this folder from url.Ex:www.abc.com/social.
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /service/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9]+|)/?$ page.php?ids=$1
Simply exclude "service" from the regex match:
RewriteRule ^service/([a-zA-Z0-9]+|)/?$ page.php?ids=$1
Place this code in site root .htaccess (i.e. parent directory of /service/
):
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !^service/ service%{REQUEST_URI} [L,NC]