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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:28:47+00:00 2026-05-27T18:28:47+00:00

RewriteRule ^(.*)/?$ ./view.php?id=$1 This works if say an id = abc123, I can access

  • 0
RewriteRule ^(.*)/?$ ./view.php?id=$1

This works if say an id = “abc123”, I can access www.site.com/abc123 perfectly fine.

But I want to be able to access with www.site.com/view/abc123

So I tried:

RewriteRule ^view/(.*)/?$ ./view.php?id=$1

But to no avail. When I try to access www.site.com/view/abc123 it seems as if it doesn’t even grab the $_GET request to get the id.
What’s wrong?

My entire .htaccess:

RewriteEngine On
RewriteBase /~user/sitetest/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^view/(.+?)/?$ view.php?id=$1

Edit:

Using the above .htaccess, when I access:
http://localhost/~user/sitetest/view/abc123

It doesn’t load the $_GET[] from view.php. I even tried echoing out $_GET[] but it shows up as blank.

If I edit it to be RewriteRule ^(.+?)/?$ view.php?id=$1
And access http://localhost/~user/sitetest/abc123 it works fine.

If I edit it to be RewriteRule ^view-(.+?)/?$ view.php?id=$1
And access http://localhost/~user/sitetest/view-abc123 it works fine.

Does it have something to do with the slash??

  • 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-27T18:28:48+00:00Added an answer on May 27, 2026 at 6:28 pm

    Try something like this:

    # this next line is really important
    RewriteBase /
    
    RewriteRule ^view/(.+?)/?$ view.php?id=$1
    

    Using RewriteBase, you are specifically telling the server to use view.php in the server’s root. If you don’t specify the RewriteBase, the server will use the view.php in the requested directory (being /view/).

    Hope this helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

RewriteEngine on RewriteRule ^page/?$ page.php [L] This ends up matching the url www.site.com/page// but
My website can be view from 2 different kind of URI: www.mywebsite.com/magazine or www.mywebsite.com/index.php/magazine
In EE 2.2.2 having this in my htaccess file RewriteRule ^(.*)$ /index.php/view/$1 [L] Allowed
I have an web application in PHP with urls like this: https://www.domain.com/?mod=test&act=view My problem
I have a URL that looks like this http://domain.com/index.php/view/test . How do i rewrite
I have this RewriteRule that works too well :-) RewriteRule ^([^/]*)/$ /script.html?id=$1 [L] The
I'm now doing this: rewriterule ^jobs/([0-9]+)/.* job.php?id=$1 Which will erase parameters in jobs/1010/title?k=v How
Right now I'm doing something like this: RewriteRule ^/?logout(/)?$ logout.php RewriteRule ^/?config(/)?$ config.php I
Here's my current rule: RewriteRule (.*) view.php?id=$1 However, I still need certain files to
This is the contents of my .htaccess file: RewriteEngine on RewriteRule ^upload$ upload.php RewriteRule

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.