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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:15:13+00:00 2026-05-26T07:15:13+00:00

Perhaps someone can help me with this before I go completely crazy with it.

  • 0

Perhaps someone can help me with this before I go completely crazy with it. I have a site with two urls which I want to redirect.

I want all traffic except the gallery pages to go to index.php.

This is my htaccess:

php_flag magic_quotes_gpc Off

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]


RewriteRule ^(.*)$ /index.php?/$1

RewriteRule ^gallery(/((([a-zA-Z0-9-]+)(/(\d+))?)/?)?)?$ gallery.php?groupId=$4&showpage=$6 [NC,QSA,L]

This works except for one part. The rewrite rule for the gallery is not fully working. It is sending through the groupId to the gallery.php script but I am not getting through the showpage argument. In fact when the showpage is included in the url I get a 404. So for instance.

These work and are handled correctly by the rewrite rule

gallery

gallery/

gallery/mygroup

gallery/mygroup/

This does not work and throws 404’s.

gallery/mygroup/2

Nothing I do seems to fix this and I would appreciate your help on this. If I set the showpage. The gallery script works if I feed it the old

gallery.php?groupId=mygroup&showpage=2

so I am sure the htaccess rule is not catching the url.

Thanks in advance.

  • 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-26T07:15:13+00:00Added an answer on May 26, 2026 at 7:15 am

    Your regex seems a little over-the-top. Use two simpler rewrite rules instead:

    RewriteRule ^gallery/([a-zA-Z0-9-]+)/?$ gallery.php?groupId=$1 [NC,QSA,L]
    RewriteRule ^gallery/([a-zA-Z0-9-]+)/(\d+)/?$ gallery.php?groupId=$1&showpage=$2 [NC,QSA,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Perhaps someone can help me out with this one: I'm using a basic search
I wonder whether someone can help me please. I've put together this page, which
This is not technically a programming question but perhaps someone can help me. Yes,
An odd error here, perhaps someone can help track down source as it's attempting
Perhaps I'm having a Post-Ballmer-Peak Moment . I'm hoping that someone can help point
Perhaps someone can point me in the correct direction, because I'm completely stumped on
I'm not sure what this practice is actually called, so perhaps someone can edit
I have a pretty simple question which perhaps someone familiar with Server/Client design &
Ok so perhaps someone can help me with a problem I'm trying to solve.
I wonder if someone can help me. I've got a console App which I

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.