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 7844217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:48:37+00:00 2026-06-02T16:48:37+00:00

I want to rewrite URL and for that I have got following code. Options

  • 0

I want to rewrite URL and for that I have got following code.

    Options +FollowSymLinks
    RewriteEngine On
    RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?uname=$1
    RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?uname=$1

now when I write url like http://www.mywebsite.com/username it works fine and not giving any error.

Now how can I get this URL even when I write http://www.mywebsite.com/index.php?uname=username in hit go.

I want to change http://www.mywebsite.com/index.php?uname=username to http://www.mywebsite.com/username when I write http://www.mywebsite.com/index.php?uname=username in URL.

As rewrite work for prefix of WWW I want same way to change my URL to http://www.mywebsite.com/username even if user write http://www.mywebsite.com/index.php?uname=username.

  • 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-02T16:48:38+00:00Added an answer on June 2, 2026 at 4:48 pm

    The following should work:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/\.]+)/?$ index.php?uname=$1
    

    It will check if the file or directory doesn’t exist, and if it doesn’t it will assume it’s an username and rewrite the URL.

    If you want to redirect from index.php?uname=username to /username then you could add this to the top of your index.php:

    if (strpos($_SERVER['REQUEST_URI'], "uname") !== false)
    {
        header("Location: /" . $_GET['uname']);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following page: mysite.com/news/index.php?tag=tag&name=name&id=id I want to rewrite this so that it
I have a URL that looks like this http://domain.com/index.php/view/test . How do i rewrite
Currently I have a url like this http://<client_name>.website.com/index.php?function_name&cat=32 I want to set things up
For my website i want to rewrite my url to: www.xxx.com/en/index.php instead of www.xxx.com/index.php?language=en
I want to rewrite the following URL in apache: abc.php?id=1234&token=xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx is a
I have a mod rewrite rule for pagination of my content: RewriteRule ^content/page/([^/]*)$ /index.php?page=$1
i have a url www.abc.com/index.php?page/Secure and i want to access it with www.abc.com/secure im
I have a database that has a url colomn like this-is-the-title.php I want to
I have the following URL: www.exampe.com/id/1234 and I want a regex that gets the
I want to rewrite http://website.com/?slug=product_info.php&products_id=32 to http://website.com/product_info/32 and I use this code, add_filter('rewrite_rules_array','wp_insertMyRewriteRules'); add_filter('query_vars','wp_insertMyRewriteQueryVars');

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.