Subfolder url get parameter not working in htaccess
I have a website like www.abc.com/service/page.php?ids=social. I redirected the site to www.abc.com/service/social. But I need to avoid this folder with 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
+3
think_user
source
to share
2 answers
Just exclude "service" from regex matching:
RewriteRule ^service/([a-zA-Z0-9]+|)/?$ page.php?ids=$1
0
cweiske
source
to share
Place this code in your site's root .htaccess directory (i.e. parent directory /service/
):
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !^service/ service%{REQUEST_URI} [L,NC]
0
anubhava
source
to share