.htaccess wild card

Dear All

I am using apache rewrite to give access to different schools

I am new to .htaccess

#Alternate default index page DirectoryIndex   mainadminlogin.php
Options +FollowSymLinks
RewriteEngine On 

DirectoryIndex mainadminlogin.php  

RewriteRule ^shalyann/shalyannacademy/?$  prog1.php?schoolid=11  [L]
RewriteRule ^shalyann-shalyannacademy/?$  prog2.php?schoolid=11 [L]
RewriteRule ^shalyann-shalyannacademy/?$  prog3.php?schoolid=11 [L]
RewriteRule ^shalyann-shalyannacademy/?$  prog4.php?schoolid=11 [L]
RewriteRule ^shalyann-shalyannacademy/?$  prog5.php?schoolid=11 [L]
RewriteRule ^shalyann-shalyannacademy/?$  prog6.php?schoolid=11 [L]
RewriteRule ^shalyann-shalyannacademy/?$  prog7.php?schoolid=11 [L]
RewriteRule ^shalyann-shalyannacademy/?$  prog8.php?schoolid=11 [L]
RewriteRule ^shalyann-shalyannacademy/?$  prog9.php?schoolid=11 [L]
RewriteRule ^shalyann-shalyannacademy/?$  prog10.php?schoolid=11 [L]
RewriteRule ^shalyann-shalyannacademy/?$  prog11.php?schoolid=11 [L]

Instead of writing htacess code for many more programs ,
can i use wild card

so that
Instead of writing .htacess code for each program to redirect
can I use wild card
so that all program specified will redirect to same program without path


will be directed to


I tried

RewriteRule ^vikasTrust/vikasPrimary/(.*)$ $1?schoolid=12 [R,L]
RewriteRule ^vikasTrust/vikasPrimary/?$ https://skyschool.in/?schoolid=12 [L,NE,R=301]

but failed

1 Like

Solution for wild card
RewriteRule ^maindir/subdir/([A-Za-z0-9-]+).php$ $1.php?schoolid=12 [L]


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.