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


source to share


2 answers


Just exclude "service" from regex matching:



RewriteRule ^service/([a-zA-Z0-9]+|)/?$ page.php?ids=$1

      

0


source


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


source







All Articles