1

I would like do the following mod_rewrite via htaccess:

/xxx/yyy/?zzz=2 --> /index.php?src=xxx/yyy/&zzz=2 

I tried the following, but it doesn't work (404 error):

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?src=$1&%{QUERY_STRING} [P,L] 

Many thanks for your help!

1 Answer 1

1

P flag is not used for what you want to do.
You have to use QSA flag instead (Query String Append)

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?src=$1 [L,QSA] 

Also, make sure mod_rewrite is enabled in your Apache server config (and AllowOverride has the right value to enable htaccess, for example All instead of None)

Sign up to request clarification or add additional context in comments.

1 Comment

You're welcome. Don't forget to validate my answer to solve your question

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.