Home Redirect Using .htaccess file - Page/pagenumber
Reply: 0

Redirect Using .htaccess file - Page/pagenumber

user43594
1#
user43594 Published in September 19, 2018, 9:09 am

I am stuck with my limited knowledge of .htaccess file.

i am migrating from one site to another. lets say my old site is cws and my new site is sa

my old site cws urls are with cws/category/category name.. while my new website sa is without category.

I also change the slug of the categories.

i write a rule like

RewriteRule ^category/love/(.*) https://newdomain.com/angry-relationship-advise/$1 [R=301,L]

now on the google search i saw my categories pages are also index.

now if someone click on google like

http://oldsite/category/love/ its redirecting to https://newdomain.com/angry-relationship-advise

But if someone click on

http://oldsite/category/love/page/2 or http://oldsite/category/love/page/3 it didn't redirect to

https://newdomain.com/angry-relationship-advise/page/2 or https://newdomain.com/angry-relationship-advise/page/3

Can anyone help me with this. i have tried (.*) or $1 but its working for base url.. not with pages.

Looking for your help.

share|improve this question
  • try in incognito mode – Ben Apr 14 at 18:55
  • Hello Ben, I have tried. .but didn't work.. Can you tell me how the statement should look like.. the thing is it redirecting to the wrong url.. newdomain.com/love/page/2 does not exist.. i want it to redirect to newdomain.com/angry-relationship-advise/page/2 – Husnain Naz Apr 14 at 19:24

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', convertImagesToLinks: true, noModals: false, showLowRepImageUploadWarning: true, reputationToPostImages: 10, bindNavPrevention: true, postfix: "", onDemand: true, discardSelector: ".discard-answer" ,immediatelyShowMarkdownHelp:true }); } });
 
StackExchange.ready( function () { StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49831958%2fredirect-using-htaccess-file-page-pagenumber%23new-answer', 'question_page'); } );

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged wordpress .htaccess redirect mod-rewrite or ask your own question.

StackExchange.ready(function(){$.get('/posts/49831958/ivc/c4f0');});
StackExchange.ready(function () { StackExchange.responsiveness.addSwitcher(); }) (function(i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function() { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m); })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); StackExchange.ready(function () { StackExchange.ga.init({ sendTitles: true, tracker: window.ga, trackingCodes: [ 'UA-108242619-1' ] }); StackExchange.ga.setDimension('dimension2', '|wordpress|.htaccess|redirect|mod-rewrite|'); StackExchange.ga.setDimension('dimension3', 'Questions/Show'); StackExchange.ga.trackPageView(); }); /**/ var _qevents = _qevents || [], _comscore = _comscore || []; (function() { var ssl = 'https:' == document.location.protocol, s = document.getElementsByTagName('script')[0], qc = document.createElement('script'); qc.async = true; qc.src = (ssl ? 'https://secure' : 'http://edge') + '.quantserve.com/quant.js'; s.parentNode.insertBefore(qc, s); _qevents.push({ qacct: "p-c1rF4kxgLUzNc" }); /**/ var sc = document.createElement('script'); sc.async = true; sc.src = (ssl ? 'https://sb' : 'http://b') + '.scorecardresearch.com/beacon.js'; s.parentNode.insertBefore(sc, s); _comscore.push({ c1: "2", c2: "17440561" }); })();
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.443135 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO