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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:45:25+00:00 2026-06-15T22:45:25+00:00

I am using mod_rewrite for clean URL’s. Until now, everything is working fine :

  • 0

I am using mod_rewrite for clean URL’s. Until now, everything is working fine :

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule (.*) application.php?request=$1 [L,QSA]
</IfModule>

But then, I just try to add another rule that transforms the www.mysite.com urls mysite.com , using the following :

<IfModule mod_rewrite.c>
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
</IfModule>

Results : when I access mysite.com it’s fine, but when accessing www.mysite.com , the URL becomes an ugly mysite.com/application.php?request=

How can I adjust my .htaccess file so there is no conflicts ?

  • 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-15T22:45:26+00:00Added an answer on June 15, 2026 at 10:45 pm

    You need to make sure the redirect rule is before the routing rule, otherwise the routing rule gets applied, the rewrite engine loops (will continue to loop until the URI stops changing) and then the redirect happens, on the rewritten URI.

    <IfModule mod_rewrite.c>
      Options +FollowSymlinks
      RewriteEngine On
    
      RewriteCond %{HTTPS} !=on
      RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
      RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
    
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule (.*) application.php?request=$1 [L,QSA]
    </IfModule>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using mod_rewrite to clean up some of my URL's (duh) and I got
I'm using mod_rewrite to transform: www.example.com/view.php?ID=1234 into www.example.com/1234 using the following rule: Options +FollowSymlinks
I am using mod_rewrite in my haccess to make clean URLs. The working directory
I am using mod_rewrite to put a category name in the URL, like locahost/categoryName
I'm trying to hide actual sub-directory from url path using mod_rewrite. The folder actual
I'm setting up some simple url rewriting rules using mod_rewrite and a .htacces file,
I am attempting clean useful URLs using mod_rewrite. I am sure this is a
I am using .htaccess and mod_rewrite in my little PHP framework. It's working nicely,
I have a PHP-Apache application using mod_rewrite for clean URLs. I am having a
I'm having a play around with using mod_rewrite to provide a better looking URL

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.