After 301 .htaccess redirect question mark in the URL with extra items
Thanks in advance for helping me. I am new here and also new to redirect rules. I have an issue after .htaccess 301 redirect I did on my website url's.
- First, the URLs slugs were with "_" (underscore).
- 2nd, I change URL's structure from "_" to "-" (hyphen).
- I now did .htaccess 301 redirects from old URL to the new URLs.
ISSUE: when I redirect the URL, and try to click my URL from google search it worked, but with extra slugs (?promo/sports_and_outdoors_coupons=23&hta&ext=
) in the URLS.
Here is my .htaccess code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
Redirect 301 /promo/auto_parts-26 /promo/auto-parts-26
Redirect 301 /promo/bath__body-27 /promo/bath--body-27
Redirect 301 /promo/computers_and_electronics-8 /promo/computers-and-electronics-8
Redirect 301 /promo/health__wellness-13 /promo/health--wellness-13
Redirect 301 /promo/home_and_garden-14 /promo/home-and-garden-14
Redirect 301 /promo/musical_instruments-16 /promo/musical-instruments-16
Redirect 301 /promo/office_supplies-17 /promo/office-supplies-17
Redirect 301 /promo/party_supplies-18 /promo/party-supplies-18
After clicking url from google search, this is the permanlink on my website:
https://website.com/promo/auto-parts-26?promo/auto_parts_26=26&hta&ext=
I need quick fix, would you kindly help, what I am doing wrong.
thank you.
Main issue occurring from this part
RewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
I removed it, url redirect correctly, but page was not loading. url not found error.
apache .htaccess redirect
add a comment |
Thanks in advance for helping me. I am new here and also new to redirect rules. I have an issue after .htaccess 301 redirect I did on my website url's.
- First, the URLs slugs were with "_" (underscore).
- 2nd, I change URL's structure from "_" to "-" (hyphen).
- I now did .htaccess 301 redirects from old URL to the new URLs.
ISSUE: when I redirect the URL, and try to click my URL from google search it worked, but with extra slugs (?promo/sports_and_outdoors_coupons=23&hta&ext=
) in the URLS.
Here is my .htaccess code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
Redirect 301 /promo/auto_parts-26 /promo/auto-parts-26
Redirect 301 /promo/bath__body-27 /promo/bath--body-27
Redirect 301 /promo/computers_and_electronics-8 /promo/computers-and-electronics-8
Redirect 301 /promo/health__wellness-13 /promo/health--wellness-13
Redirect 301 /promo/home_and_garden-14 /promo/home-and-garden-14
Redirect 301 /promo/musical_instruments-16 /promo/musical-instruments-16
Redirect 301 /promo/office_supplies-17 /promo/office-supplies-17
Redirect 301 /promo/party_supplies-18 /promo/party-supplies-18
After clicking url from google search, this is the permanlink on my website:
https://website.com/promo/auto-parts-26?promo/auto_parts_26=26&hta&ext=
I need quick fix, would you kindly help, what I am doing wrong.
thank you.
Main issue occurring from this part
RewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
I removed it, url redirect correctly, but page was not loading. url not found error.
apache .htaccess redirect
Main issue occurring from this partRewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
I removed it, url redirect correlty, but page was not loading. url not found error.
– hassan
Nov 14 '18 at 19:59
What you call the "extra slugs" is there because of flag QSA. You are telling RewriteRule to do that, see httpd.apache.org/docs/2.4/rewrite/flags.html#flag_qsa
– Nic3500
Nov 15 '18 at 12:39
Note for your RewrireRule with index.php: what url do you expect this rule will receive? I think you are trying to setup a rule to look at the contents after the?
sign. Everything after the?
is considered the QUERY_STRING, not part of the URL per say. So your rule will never work. See stackoverflow.com/questions/2252238/…
– Nic3500
Nov 15 '18 at 12:45
there is no method for my redirects to work? I am not familiar with the htaccess rewrite rules etc. that is why I am here.. I need help. to make it work.
– hassan
Nov 15 '18 at 20:39
Edit the question with: the requirement. What are you trying to accomplish exactly, with details. Then what you have tried, the expected result and the current result. It is also required for you to post your tests and show how they failed. Right now we have some rules and a line you say has an issue. Lastly I suggest you read on mod_rewrite, and understand the difference between the QUERY_STRING and the REQUEST_URI.
– Nic3500
Nov 16 '18 at 1:48
add a comment |
Thanks in advance for helping me. I am new here and also new to redirect rules. I have an issue after .htaccess 301 redirect I did on my website url's.
- First, the URLs slugs were with "_" (underscore).
- 2nd, I change URL's structure from "_" to "-" (hyphen).
- I now did .htaccess 301 redirects from old URL to the new URLs.
ISSUE: when I redirect the URL, and try to click my URL from google search it worked, but with extra slugs (?promo/sports_and_outdoors_coupons=23&hta&ext=
) in the URLS.
Here is my .htaccess code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
Redirect 301 /promo/auto_parts-26 /promo/auto-parts-26
Redirect 301 /promo/bath__body-27 /promo/bath--body-27
Redirect 301 /promo/computers_and_electronics-8 /promo/computers-and-electronics-8
Redirect 301 /promo/health__wellness-13 /promo/health--wellness-13
Redirect 301 /promo/home_and_garden-14 /promo/home-and-garden-14
Redirect 301 /promo/musical_instruments-16 /promo/musical-instruments-16
Redirect 301 /promo/office_supplies-17 /promo/office-supplies-17
Redirect 301 /promo/party_supplies-18 /promo/party-supplies-18
After clicking url from google search, this is the permanlink on my website:
https://website.com/promo/auto-parts-26?promo/auto_parts_26=26&hta&ext=
I need quick fix, would you kindly help, what I am doing wrong.
thank you.
Main issue occurring from this part
RewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
I removed it, url redirect correctly, but page was not loading. url not found error.
apache .htaccess redirect
Thanks in advance for helping me. I am new here and also new to redirect rules. I have an issue after .htaccess 301 redirect I did on my website url's.
- First, the URLs slugs were with "_" (underscore).
- 2nd, I change URL's structure from "_" to "-" (hyphen).
- I now did .htaccess 301 redirects from old URL to the new URLs.
ISSUE: when I redirect the URL, and try to click my URL from google search it worked, but with extra slugs (?promo/sports_and_outdoors_coupons=23&hta&ext=
) in the URLS.
Here is my .htaccess code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
Redirect 301 /promo/auto_parts-26 /promo/auto-parts-26
Redirect 301 /promo/bath__body-27 /promo/bath--body-27
Redirect 301 /promo/computers_and_electronics-8 /promo/computers-and-electronics-8
Redirect 301 /promo/health__wellness-13 /promo/health--wellness-13
Redirect 301 /promo/home_and_garden-14 /promo/home-and-garden-14
Redirect 301 /promo/musical_instruments-16 /promo/musical-instruments-16
Redirect 301 /promo/office_supplies-17 /promo/office-supplies-17
Redirect 301 /promo/party_supplies-18 /promo/party-supplies-18
After clicking url from google search, this is the permanlink on my website:
https://website.com/promo/auto-parts-26?promo/auto_parts_26=26&hta&ext=
I need quick fix, would you kindly help, what I am doing wrong.
thank you.
Main issue occurring from this part
RewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
I removed it, url redirect correctly, but page was not loading. url not found error.
apache .htaccess redirect
apache .htaccess redirect
edited Nov 15 '18 at 12:39
Nic3500
3,33281829
3,33281829
asked Nov 14 '18 at 19:09
hassanhassan
11
11
Main issue occurring from this partRewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
I removed it, url redirect correlty, but page was not loading. url not found error.
– hassan
Nov 14 '18 at 19:59
What you call the "extra slugs" is there because of flag QSA. You are telling RewriteRule to do that, see httpd.apache.org/docs/2.4/rewrite/flags.html#flag_qsa
– Nic3500
Nov 15 '18 at 12:39
Note for your RewrireRule with index.php: what url do you expect this rule will receive? I think you are trying to setup a rule to look at the contents after the?
sign. Everything after the?
is considered the QUERY_STRING, not part of the URL per say. So your rule will never work. See stackoverflow.com/questions/2252238/…
– Nic3500
Nov 15 '18 at 12:45
there is no method for my redirects to work? I am not familiar with the htaccess rewrite rules etc. that is why I am here.. I need help. to make it work.
– hassan
Nov 15 '18 at 20:39
Edit the question with: the requirement. What are you trying to accomplish exactly, with details. Then what you have tried, the expected result and the current result. It is also required for you to post your tests and show how they failed. Right now we have some rules and a line you say has an issue. Lastly I suggest you read on mod_rewrite, and understand the difference between the QUERY_STRING and the REQUEST_URI.
– Nic3500
Nov 16 '18 at 1:48
add a comment |
Main issue occurring from this partRewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
I removed it, url redirect correlty, but page was not loading. url not found error.
– hassan
Nov 14 '18 at 19:59
What you call the "extra slugs" is there because of flag QSA. You are telling RewriteRule to do that, see httpd.apache.org/docs/2.4/rewrite/flags.html#flag_qsa
– Nic3500
Nov 15 '18 at 12:39
Note for your RewrireRule with index.php: what url do you expect this rule will receive? I think you are trying to setup a rule to look at the contents after the?
sign. Everything after the?
is considered the QUERY_STRING, not part of the URL per say. So your rule will never work. See stackoverflow.com/questions/2252238/…
– Nic3500
Nov 15 '18 at 12:45
there is no method for my redirects to work? I am not familiar with the htaccess rewrite rules etc. that is why I am here.. I need help. to make it work.
– hassan
Nov 15 '18 at 20:39
Edit the question with: the requirement. What are you trying to accomplish exactly, with details. Then what you have tried, the expected result and the current result. It is also required for you to post your tests and show how they failed. Right now we have some rules and a line you say has an issue. Lastly I suggest you read on mod_rewrite, and understand the difference between the QUERY_STRING and the REQUEST_URI.
– Nic3500
Nov 16 '18 at 1:48
Main issue occurring from this part
RewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
I removed it, url redirect correlty, but page was not loading. url not found error.– hassan
Nov 14 '18 at 19:59
Main issue occurring from this part
RewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
I removed it, url redirect correlty, but page was not loading. url not found error.– hassan
Nov 14 '18 at 19:59
What you call the "extra slugs" is there because of flag QSA. You are telling RewriteRule to do that, see httpd.apache.org/docs/2.4/rewrite/flags.html#flag_qsa
– Nic3500
Nov 15 '18 at 12:39
What you call the "extra slugs" is there because of flag QSA. You are telling RewriteRule to do that, see httpd.apache.org/docs/2.4/rewrite/flags.html#flag_qsa
– Nic3500
Nov 15 '18 at 12:39
Note for your RewrireRule with index.php: what url do you expect this rule will receive? I think you are trying to setup a rule to look at the contents after the
?
sign. Everything after the ?
is considered the QUERY_STRING, not part of the URL per say. So your rule will never work. See stackoverflow.com/questions/2252238/…– Nic3500
Nov 15 '18 at 12:45
Note for your RewrireRule with index.php: what url do you expect this rule will receive? I think you are trying to setup a rule to look at the contents after the
?
sign. Everything after the ?
is considered the QUERY_STRING, not part of the URL per say. So your rule will never work. See stackoverflow.com/questions/2252238/…– Nic3500
Nov 15 '18 at 12:45
there is no method for my redirects to work? I am not familiar with the htaccess rewrite rules etc. that is why I am here.. I need help. to make it work.
– hassan
Nov 15 '18 at 20:39
there is no method for my redirects to work? I am not familiar with the htaccess rewrite rules etc. that is why I am here.. I need help. to make it work.
– hassan
Nov 15 '18 at 20:39
Edit the question with: the requirement. What are you trying to accomplish exactly, with details. Then what you have tried, the expected result and the current result. It is also required for you to post your tests and show how they failed. Right now we have some rules and a line you say has an issue. Lastly I suggest you read on mod_rewrite, and understand the difference between the QUERY_STRING and the REQUEST_URI.
– Nic3500
Nov 16 '18 at 1:48
Edit the question with: the requirement. What are you trying to accomplish exactly, with details. Then what you have tried, the expected result and the current result. It is also required for you to post your tests and show how they failed. Right now we have some rules and a line you say has an issue. Lastly I suggest you read on mod_rewrite, and understand the difference between the QUERY_STRING and the REQUEST_URI.
– Nic3500
Nov 16 '18 at 1:48
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f53307191%2fafter-301-htaccess-redirect-question-mark-in-the-url-with-extra-items%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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%2f53307191%2fafter-301-htaccess-redirect-question-mark-in-the-url-with-extra-items%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
Main issue occurring from this part
RewriteRule ^(.*?)(-(d+))?([.]w+|/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
I removed it, url redirect correlty, but page was not loading. url not found error.– hassan
Nov 14 '18 at 19:59
What you call the "extra slugs" is there because of flag QSA. You are telling RewriteRule to do that, see httpd.apache.org/docs/2.4/rewrite/flags.html#flag_qsa
– Nic3500
Nov 15 '18 at 12:39
Note for your RewrireRule with index.php: what url do you expect this rule will receive? I think you are trying to setup a rule to look at the contents after the
?
sign. Everything after the?
is considered the QUERY_STRING, not part of the URL per say. So your rule will never work. See stackoverflow.com/questions/2252238/…– Nic3500
Nov 15 '18 at 12:45
there is no method for my redirects to work? I am not familiar with the htaccess rewrite rules etc. that is why I am here.. I need help. to make it work.
– hassan
Nov 15 '18 at 20:39
Edit the question with: the requirement. What are you trying to accomplish exactly, with details. Then what you have tried, the expected result and the current result. It is also required for you to post your tests and show how they failed. Right now we have some rules and a line you say has an issue. Lastly I suggest you read on mod_rewrite, and understand the difference between the QUERY_STRING and the REQUEST_URI.
– Nic3500
Nov 16 '18 at 1:48