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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:09:12+00:00 2026-05-19T15:09:12+00:00

I have a problem with my .htaccess redirects. I have both a rewrite rule

  • 0

I have a problem with my .htaccess redirects. I have both a rewrite rule to remove the “index.php?/” from my URLs (I’m using a PHP framework), and also 301 redirects redirecting from old pages:

# START THE REWRITE
RewriteEngine on
Options -Indexes
Options +FollowSymLinks
RewriteCond $1 !^(index\.php|assets)
RewriteRule ^(.*)$ /index.php?/$1 [L]

# 301 REDIRECTS
Redirect 301 /oldpage.html http://www.example.com/old_page
Redirect 301 /page.html http://www.example.com/page
Redirect 301 /page-that-no-longer-exists.html http://www.example.com/

I can’t rename my .html files with another rewrite rule as some of the pages don’t match the new pages, and some other .html pages are redirecting to the home page – hence the 301 redirects.

And so, because of the rewrite rule, the first 301 redirect will direct to

http://www.example.com/old_page?/old_page.html

instead of

http://www.example.com/old_page

I have tried reordering the contents of the .htaccess file (which does nothing), setting the rewrite to “off” after the rewrite (which stops the 301’s working) and writing specific rewrite rules for each 301 (none of which worked).

I’m sure i’m missing something. Cheers.

  • 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-19T15:09:13+00:00Added an answer on May 19, 2026 at 3:09 pm

    OK, I’ve come up with a couple of solutions.

    The first is to send the redirect in the example to

    Redirect 301 /oldpage.html http://www.example.com/index.php?/old_page
    

    This does not apply the rewrite removing the “index.php?”, but it does work.

    The second work around is to edit the rewrite conditions to exclude any .php or .html files:

    RewriteCond $1 !^([a-zA-Z1-9\-\_/]*\.php$|assets|[a-zA-Z1-9\-\_/]*\.html$)
    

    This may also exluce any URLs that end in .php or .html, meaning the rewrite won’t work, and your framework will break, but as long as you stay away from that you should be ok.

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

Sidebar

Related Questions

I'm using .htaccess (mod rewrite) to have pretty looking SEO friendly URLs. I have
I have an .htaccess file, works fine. But, not for /specialsubfolder . http://www.mydomain.com/specialsubfolder/index.php redirects
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
hello i'm using this .htaccess code to redirect urls. RewriteEngine on RewriteRule ^printer/([^/\.]+)/?$ printer.php?id=$1
I have some problem with my .htaccess file. Here I am adding my problem.
I have a problem, surprise ;) I use .htaccess in Apache and have a
I have problem with $_POST data. Some fields are missing from input form when
I have problem with Android using the class HttpUrlConnection my method is this: public
I have problem thinking this trough with PHP & Mysql . I have read
I'm having a small problem with my htaccess files. Currently, it redirects everything back

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.