0

I have an assignment to add storeId parameter to wrong urls.

It should behave like this:

If url has directorystore/a in it like www.example.com/store/a - the next directory in path has to be

www.example.com/store/a/dir1 or

www.example.com/store/a/dir2 or

www.example.com/store/a/dir3

otherwise it should add storeId parameter to the end of it

for example: www.example.com/store/a/dir3blahblah/something?storeId=123 or

www.example.com/store/a/dir3blahblah?storeId=123

I wrote a httpd.conf rewriterule here:

RewriteCond %{REQUEST_URI} ^/store/a/
RewriteCond %{REQUEST_URI} !^/store/a/dir1
RewriteCond %{REQUEST_URI} !^/store/a/dir2
RewriteCond %{REQUEST_URI} !^/store/a/dir3
RewriteRule ^/store/(.*) /store/$1?&storeId=123 [PT,L]

But as a newb to configuring that server I'm 80% sure that there are some mistakes and unfortunately I have no chance to test that piece. So I'm expecting that you guys might check that out and maybe help me to fix my mistakes. Thank you.

0 Answers0