Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8528405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:47:40+00:00 2026-06-11T08:47:40+00:00

I wanted to ask you a question about 301 URL redirection. So, I have

  • 0

I wanted to ask you a question about 301 URL redirection. So, I have a website and it’s former URL used to be:

http://www.sample.com/tutorials.php?name=sample

But, now it’s:

http://www.sample.com/tutorials/programming/sample.php

So, you can conclude that the syntax of the new URL is this:

http://www.sample.com/tutorials/(name of the category)/(value of the variable).php

I’ve been toying around with 301 redirect, but I got 500 Internal server error when I used this code:

RewriteEngine On
RewriteCond %{COND ^tutorials.php?name=sample$ HTTP/1.1} ^[A-Z]{3,9}\ /tutorials\.php\?name=([^&\ ]+)
RewriteRule ^ /tutorials/programming/%1.php [L,R=301]

I have also tried to create my own 301 redirect code, which gives me no 500 Internal server error, but I don’t know will it work (I can’t test it on localhost, because search engines don’t index localhost). Here it is :

RewriteEngine On
Redirect 301 /tutorials.php?name=$1 http://www.sample.com/tutorials/programming/(.+)\.php

So, if my code above is good than great, but if it’s not, can someone please explain (as slowly and as detailed as possible, please) how to 301 redirect my old site to my new one. As I mentioned, I use dynamic web-sites and I am rewritting using .htaccess file (mod_rewrite).

I have tried to be as detailed as possible. If you need additional details, feel free to ask.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:47:41+00:00Added an answer on June 11, 2026 at 8:47 am

    You have to redirect the old links to your new domain. This is how you can do it.

    Using htaccess:

    Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
    The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] 
    

    In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website.

    Note: This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

    Refer this for more methods

    EDIT:

    Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to http://www.domain.com
    The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{http_host} ^domain.com [nc]
    rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to ask a question about server data. I am new to server
I was reading this question , I wanted to ask more about the code
I want to ask a question about the JavaScript event. I have an <input
This isn't really a coding question, but I wanted to ask about what is
I am Studying PHP, and i wanted to ask about references, My question: What
(I am sorry, I wanted to ask this question on meta first, but it
The question I always wanted to ask and was afraid to, actually - what
Just wanted to ask you about the drawbacks (I mean memory or reponse time)
I just wanted to ask. I have text input to allow users to type
I have a question about best practices with the Module Design Pattern. The code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.