Quantcast
Channel: BulletProof Security Forum » All Posts
Viewing all articles
Browse latest Browse all 12461

Reply To: htaccess Redirect Code – Where Do I Add Redirect htaccess Code

$
0
0

Thank you for your quick & detailed response. The 3rd/last portion you showed looked quite similar to the format I had constructed that I was going to try if you hadn’t replied that was based on examples I found on different forums, but yet you saying that such would be for the “old site” threw me so-to-speak.

I should have been a bit more specific in my examples and my situation; which was my fault indeed.

I had managed a website ending in .com that was on shared hosting via GoDaddy.

Later, the owner purchased their own VPS and a .org version of the Domain (and thus had a .com & .org version of the same Website name –though the actual sites were structured differently). After a period of time, the .com website hosting was purposely let-go (while keeping the domain of course). Thus, the .com needed/needs to be synced to the .org when it comes to all similar/parallel products, pages, categories, links, etc. (as the .com had already made a name for itself on search engines, forums, and review boards).

When it comes to general redirection, the .com has already been made into a DNS alias & has an overall forwarding-config going to the .org set-up via GoDaddy’s DNS/Domain services (and it has been working perfectly). But for old page names & numbers which are different on the new .org site, 400’s are of course thrown unless proper redirects are put in place.

Via viewing this forum, I was able to correct URL name mismatches. But it is the "http://website.com/?p=####" to "https://website.org/page/of-something/" sort of mismatch that I’m having issues with. (And yes, the .com was HTTP and the .org is HTTPS; though I have yet to see an issue with that.)

Thus, the I cannot put the code into the htaccess file on the “old site”, as the old site technically doesn’t exist anymore; well, actually, technically speaking, the .org’s htaccess is now the .com’s htaccess seeming that the one is now the alias of the other…

I’m not sure if I’ve just clarified that your code should in-fact still work in my situation or not, but I rather be safe than sorry.

Lastly, just to show in-case it may be of aid, here is the format I was planning on using based on another example:

# Rewrite rules per example of:
#RewriteEngine On
#RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
#RewriteRule ^(.*)$ http://www.sample-site.com/path/to-proper/page/ [R=302,L]

RewriteEngine On

RewriteCond %{QUERY_STRING} ^p=([167]*)$
RewriteRule ^/$ https://website.org/new-page/ [R=301,L]
RewriteCond %{QUERY_STRING} ^p=([3048]*)$
RewriteRule ^/$ https://website.org/topic/sub-topic/page/ [R=301,L]
RewriteCond %{QUERY_STRING} ^p=([3068]*)$
RewriteRule ^/$ https://website.org/category/subcategory/product/index/page/ [R=301,L]
# END Custom Redirects for Query Strings
  • This reply was modified 12 hours, 32 minutes ago by Profile photo of DKK DKK. Reason: 2 Typos fixed
  • This reply was modified 10 hours, 49 minutes ago by Profile photo of AITpro Admin AITpro Admin.

Viewing all articles
Browse latest Browse all 12461

Trending Articles