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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:44:35+00:00 2026-06-09T18:44:35+00:00

I want to redirect rewrite /zp-core/admin.php to admin but somehow I can’t get it

  • 0

I want to redirect rewrite /zp-core/admin.php to admin but somehow I can’t get it to work.

I’ve added this rule to my htaccess:

RewriteEngine On

RewriteBase /

RewriteRule ^/admin$ /zp-core/admin.php [L]

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^albums/?(.+/?)?$ $1 [R=301,L] 
...
# Catch-all - everything else gets handled in PHP for compatibility.
RewriteRule ^(.*)/?$                        index.php?album=$1 [L,QSA]

The third rule should do it, but somehow it doesn’t. In the end it falls back on the catch all rule

  • 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-09T18:44:36+00:00Added an answer on June 9, 2026 at 6:44 pm

    When you say “rewrite A to B“, usually, “A” is what the user types and “B” is where you want him to get.

    If A=’/admin‘ and B=’/zp-core/admin.php‘ then the first rule is ok, if you remove other rules, it will work.

    The problem is – apache looks into .htaccess on every request, including sub-requests, and your redirect does a sub-request… So it does not match the first rule anymore, but then comes the catch-all rule, and it is a match again (you’ll see that $_GET["album"] will be /zp-core/admin.php when hitting index.php on such request.

    What you need to do is to add RewriteCond either checking that the uri is not /zp-core/admin.php OR that you’re not in sub-request…

    Either:

    RewriteCond %{REQUEST_URI} !^/zp-core/admin.php$
    

    OR:

    RewriteCond %{IS_SUBREQ} !=true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to redirect using .htaccess abc.com/test.php to abc.com/test . but it will execute/display
I want to redirect or rewrite sub directories to PHP files Such as: http://www.domain.org/contact
I want to rewrite /home to the index.php and /edit to edit.php , but
I want to use htaccess to 301 redirect (not rewrite) urls like: brands.php?brand=Sony to
I want to redirect from /gallery/X to gallery.php?category=X But when I actually goto the
I want to redirect all requests like: /xml/doSomething?arg=value To: /xml.php?action=doSomething&arg=value I tried this simple
Little question with .htaccess rewrite rule.. I want to redirect http request like that:
I want to redirect all requests for index.html|php|php5 to http://www.domain.co.uk/ using mod_rewrite and I've
I'm using Mod Rewrite for IIS 7.0 from iis.net and want to redirect requests:
I want to redirect to home page if session get invalid. My spring-servlet.xml is

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.