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

  • Home
  • SEARCH
  • 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 7447403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:35:39+00:00 2026-05-29T12:35:39+00:00

I need to have mysite.com/comment.php?id=sasdfkjsfj redirected to mysite.com/sasdfkjsfj. Right now, i’m using this code

  • 0

I need to have

mysite.com/comment.php?id=sasdfkjsfj

redirected to

mysite.com/sasdfkjsfj.

Right now, i’m using this code for doing that

RewriteEngine on
RewriteBase / 

#redirect to remove comment.php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /comment\.php\?id=([^\ &]+) [NC]  
RewriteRule ^ %1? [L,R=301] 

#process the SEF Url with comment.php
RewriteRule ^([-a-zA-Z]+)$ comment.php?id=$1 [L]

It changes the url address to

mysite.com/sasdfkjsfj.

but that results a 404 page error. I have a separate comment.php page which is doing the job for

 mysite.com/comment.php?id=sasdfkjsfj

where i get the id by $_GET[‘id’] from the url but now, how to handle

mysite.com/sasdfkjsfj

after redirection.

And also what changes i have to make for this type of URL

mysite.com/sasdfkjsfj/Url_redirect_option.
  • 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-05-29T12:35:40+00:00Added an answer on May 29, 2026 at 12:35 pm

    I’m just going to presume you want to redirect mysite.com/sasdfkjsfj to mysite.com/comment.php?id=sasdfkjsfj; the reverese would be unusual.

    Add the following .htaccess into the base web directory, or into your apache config:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    # if you want to use /comment/ as a base dir, as suggested by ThinkingMonkey
    # then you could use this instead
    # RewriteRule ^comment/([a-zA-Z0-9_]+)$ /comment.php?id=$1 [L]
    
    # look for "mysite.com/anyasciichars" without a . or a /
    # the [L] means this is the last rule processed (if it matches)
    RewriteRule ^([a-zA-Z0-9_]+)$ /comment.php?id=$1 [L]
    </IfModule>
    

    To handle the case of mysite.com/sasdfkjsfj/rewrite_rule, do something like this:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    # look for "mysite.com/anyasciichars/rewrite_rule"
    # the [L] means this is the last rule processed (if it matches)
    RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)$ /comment.php?id=$1&rule=$2 [L]
    </IfModule>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this url: http://mysite.com/content/14 and this line in htaccess file: RewriteRule ^content\/([^-]+)$ index.php?m=apple&id=$1
I need to do this: I have an old URL: http://www.mysite.com/dev-site/some-content-part-here That I want
I have a website with urls like this : www.mysite.com/controller/action/id I need to create
I need to put an URL (something along the lines of mysite.com/this/is/my/url) into an
I have http://mysite.com/index.php . And a sub menu home => http://mysite.com/index.php about us =>
I need to develop a multi-tenant website like sample1.mysite.com sample2.mysite.com Hold on! No, this
Here is the subject: http://www.mysite.com/files/get/937IPiztQG/the-blah-blah-text-i-dont-need.mov What I need using regex is only the bit
I have a PHP file located in a folder (www.mysite.com/folder/test.php) which accepts a get
I have this code: <label style=display: inline; for=default> <img class=ful src=http://www.mysite.com/default.png /> <input style=display:none
Let's say i have a form <form action=delete_post.php method=post>...</form> on my website: http://mysite.com and

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.