What does $1 [QSA,L] mean in my .htaccess file?
up vote
86
down vote
favorite
I need to change my .htaccess
and there are two lines which I don't understand.
RewriteCond %REQUEST_FILENAME !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
When I should use these lines ?
.htaccess
add a comment |
up vote
86
down vote
favorite
I need to change my .htaccess
and there are two lines which I don't understand.
RewriteCond %REQUEST_FILENAME !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
When I should use these lines ?
.htaccess
2
Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
– Jo Smo
Aug 7 '14 at 18:08
add a comment |
up vote
86
down vote
favorite
up vote
86
down vote
favorite
I need to change my .htaccess
and there are two lines which I don't understand.
RewriteCond %REQUEST_FILENAME !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
When I should use these lines ?
.htaccess
I need to change my .htaccess
and there are two lines which I don't understand.
RewriteCond %REQUEST_FILENAME !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
When I should use these lines ?
.htaccess
.htaccess
edited Sep 24 '12 at 22:14
Kev
96.4k44262353
96.4k44262353
asked Sep 23 '12 at 10:05
yossi
6511613
6511613
2
Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
– Jo Smo
Aug 7 '14 at 18:08
add a comment |
2
Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
– Jo Smo
Aug 7 '14 at 18:08
2
2
Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
– Jo Smo
Aug 7 '14 at 18:08
Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
– Jo Smo
Aug 7 '14 at 18:08
add a comment |
3 Answers
3
active
oldest
votes
up vote
193
down vote
accepted
Not the place to give a complete tutorial, but here it is in short;
RewriteCond basically means "execute the next RewriteRule only if this is true". The !-l
path is the condition that the request is not for a link (!
means not, -l
means link)
The RewriteRule basically means that if the request is done that matches ^(.+)$
(matches any URL except the server root), it will be rewritten as index.php?url=$1
which means a request for olle
will be rewritten as index.php?url=olle
).
QSA
means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1
will be rewritten as index.php?url=olle&p=1
.
L
means if the rule matches, don't process any more RewriteRules below this one.
For more complete info on this, follow the links above. The rewrite support can be a bit hard to grasp, but there are quite a few examples on stackoverflow to learn from.
QSA replaces?
to&
, making it impossible to distinguish between/page&foobar
vs/page?foobar
. How can I stop QSA from replacing?
to&
?
– Pacerier
Sep 27 '17 at 6:04
add a comment |
up vote
6
down vote
If the following conditions are true, then rewrite the URL:
If the requested filename is not a directory,
RewriteCond %REQUEST_FILENAME !-d
and if the requested filename is not a regular file that exists,
RewriteCond %REQUEST_FILENAME !-f
and if the requested filename is not a symbolic link,
RewriteCond %REQUEST_FILENAME !-l
then rewrite the URL in the following way:
Take the whole request filename and provide it as the value of a "url" query parameter to index.php. Append any query string from the original URL as further query parameters (QSA), and stop processing this .htaccess file (L).
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
add a comment |
up vote
0
down vote
This will capture requests for files like version
,release
, and README.md
, etc. which should be
treated either as endpoints, if defined (as in the
case of /release), or as "not found."
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
193
down vote
accepted
Not the place to give a complete tutorial, but here it is in short;
RewriteCond basically means "execute the next RewriteRule only if this is true". The !-l
path is the condition that the request is not for a link (!
means not, -l
means link)
The RewriteRule basically means that if the request is done that matches ^(.+)$
(matches any URL except the server root), it will be rewritten as index.php?url=$1
which means a request for olle
will be rewritten as index.php?url=olle
).
QSA
means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1
will be rewritten as index.php?url=olle&p=1
.
L
means if the rule matches, don't process any more RewriteRules below this one.
For more complete info on this, follow the links above. The rewrite support can be a bit hard to grasp, but there are quite a few examples on stackoverflow to learn from.
QSA replaces?
to&
, making it impossible to distinguish between/page&foobar
vs/page?foobar
. How can I stop QSA from replacing?
to&
?
– Pacerier
Sep 27 '17 at 6:04
add a comment |
up vote
193
down vote
accepted
Not the place to give a complete tutorial, but here it is in short;
RewriteCond basically means "execute the next RewriteRule only if this is true". The !-l
path is the condition that the request is not for a link (!
means not, -l
means link)
The RewriteRule basically means that if the request is done that matches ^(.+)$
(matches any URL except the server root), it will be rewritten as index.php?url=$1
which means a request for olle
will be rewritten as index.php?url=olle
).
QSA
means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1
will be rewritten as index.php?url=olle&p=1
.
L
means if the rule matches, don't process any more RewriteRules below this one.
For more complete info on this, follow the links above. The rewrite support can be a bit hard to grasp, but there are quite a few examples on stackoverflow to learn from.
QSA replaces?
to&
, making it impossible to distinguish between/page&foobar
vs/page?foobar
. How can I stop QSA from replacing?
to&
?
– Pacerier
Sep 27 '17 at 6:04
add a comment |
up vote
193
down vote
accepted
up vote
193
down vote
accepted
Not the place to give a complete tutorial, but here it is in short;
RewriteCond basically means "execute the next RewriteRule only if this is true". The !-l
path is the condition that the request is not for a link (!
means not, -l
means link)
The RewriteRule basically means that if the request is done that matches ^(.+)$
(matches any URL except the server root), it will be rewritten as index.php?url=$1
which means a request for olle
will be rewritten as index.php?url=olle
).
QSA
means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1
will be rewritten as index.php?url=olle&p=1
.
L
means if the rule matches, don't process any more RewriteRules below this one.
For more complete info on this, follow the links above. The rewrite support can be a bit hard to grasp, but there are quite a few examples on stackoverflow to learn from.
Not the place to give a complete tutorial, but here it is in short;
RewriteCond basically means "execute the next RewriteRule only if this is true". The !-l
path is the condition that the request is not for a link (!
means not, -l
means link)
The RewriteRule basically means that if the request is done that matches ^(.+)$
(matches any URL except the server root), it will be rewritten as index.php?url=$1
which means a request for olle
will be rewritten as index.php?url=olle
).
QSA
means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1
will be rewritten as index.php?url=olle&p=1
.
L
means if the rule matches, don't process any more RewriteRules below this one.
For more complete info on this, follow the links above. The rewrite support can be a bit hard to grasp, but there are quite a few examples on stackoverflow to learn from.
edited Nov 10 at 5:39
SherylHohman
4,33663245
4,33663245
answered Sep 23 '12 at 10:30
Joachim Isaksson
141k16199238
141k16199238
QSA replaces?
to&
, making it impossible to distinguish between/page&foobar
vs/page?foobar
. How can I stop QSA from replacing?
to&
?
– Pacerier
Sep 27 '17 at 6:04
add a comment |
QSA replaces?
to&
, making it impossible to distinguish between/page&foobar
vs/page?foobar
. How can I stop QSA from replacing?
to&
?
– Pacerier
Sep 27 '17 at 6:04
QSA replaces
?
to &
, making it impossible to distinguish between /page&foobar
vs /page?foobar
. How can I stop QSA from replacing ?
to &
?– Pacerier
Sep 27 '17 at 6:04
QSA replaces
?
to &
, making it impossible to distinguish between /page&foobar
vs /page?foobar
. How can I stop QSA from replacing ?
to &
?– Pacerier
Sep 27 '17 at 6:04
add a comment |
up vote
6
down vote
If the following conditions are true, then rewrite the URL:
If the requested filename is not a directory,
RewriteCond %REQUEST_FILENAME !-d
and if the requested filename is not a regular file that exists,
RewriteCond %REQUEST_FILENAME !-f
and if the requested filename is not a symbolic link,
RewriteCond %REQUEST_FILENAME !-l
then rewrite the URL in the following way:
Take the whole request filename and provide it as the value of a "url" query parameter to index.php. Append any query string from the original URL as further query parameters (QSA), and stop processing this .htaccess file (L).
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
add a comment |
up vote
6
down vote
If the following conditions are true, then rewrite the URL:
If the requested filename is not a directory,
RewriteCond %REQUEST_FILENAME !-d
and if the requested filename is not a regular file that exists,
RewriteCond %REQUEST_FILENAME !-f
and if the requested filename is not a symbolic link,
RewriteCond %REQUEST_FILENAME !-l
then rewrite the URL in the following way:
Take the whole request filename and provide it as the value of a "url" query parameter to index.php. Append any query string from the original URL as further query parameters (QSA), and stop processing this .htaccess file (L).
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
add a comment |
up vote
6
down vote
up vote
6
down vote
If the following conditions are true, then rewrite the URL:
If the requested filename is not a directory,
RewriteCond %REQUEST_FILENAME !-d
and if the requested filename is not a regular file that exists,
RewriteCond %REQUEST_FILENAME !-f
and if the requested filename is not a symbolic link,
RewriteCond %REQUEST_FILENAME !-l
then rewrite the URL in the following way:
Take the whole request filename and provide it as the value of a "url" query parameter to index.php. Append any query string from the original URL as further query parameters (QSA), and stop processing this .htaccess file (L).
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
If the following conditions are true, then rewrite the URL:
If the requested filename is not a directory,
RewriteCond %REQUEST_FILENAME !-d
and if the requested filename is not a regular file that exists,
RewriteCond %REQUEST_FILENAME !-f
and if the requested filename is not a symbolic link,
RewriteCond %REQUEST_FILENAME !-l
then rewrite the URL in the following way:
Take the whole request filename and provide it as the value of a "url" query parameter to index.php. Append any query string from the original URL as further query parameters (QSA), and stop processing this .htaccess file (L).
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
answered Jul 21 '17 at 0:03
antelove
66547
66547
add a comment |
add a comment |
up vote
0
down vote
This will capture requests for files like version
,release
, and README.md
, etc. which should be
treated either as endpoints, if defined (as in the
case of /release), or as "not found."
add a comment |
up vote
0
down vote
This will capture requests for files like version
,release
, and README.md
, etc. which should be
treated either as endpoints, if defined (as in the
case of /release), or as "not found."
add a comment |
up vote
0
down vote
up vote
0
down vote
This will capture requests for files like version
,release
, and README.md
, etc. which should be
treated either as endpoints, if defined (as in the
case of /release), or as "not found."
This will capture requests for files like version
,release
, and README.md
, etc. which should be
treated either as endpoints, if defined (as in the
case of /release), or as "not found."
answered Sep 13 '17 at 4:50
Pyae Sone
293312
293312
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f12551382%2fwhat-does-1-qsa-l-mean-in-my-htaccess-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
– Jo Smo
Aug 7 '14 at 18:08