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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:29:21+00:00 2026-06-06T13:29:21+00:00

My .htaccess file is as follows: Options -Multiviews RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com RewriteRule

  • 0

My .htaccess file is as follows:

Options -Multiviews
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php

It works, but I’m wondering how it works. For example, if I type in example.com/main, I get the file at www.example.com/main.php. How do I get the .php extension if the code tells the rewriting to stop after adding the www. to the beginning of example.com?

Edit: Or should I create a unique ID only for the purpose of logging in the remembered user?

  • 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-06T13:29:23+00:00Added an answer on June 6, 2026 at 1:29 pm

    The particular behavior you’re asking about comes about because the rule

    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    

    is a 301 redirect; it instructs the browser to initiate a completely new HTTP request. The L only causes (can only cause) it to be the last rule executed for that request; the new request comes in with the correct hostname and proceeds onward.

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

Sidebar

Related Questions

My .htaccess file is as follows: Options -Multiviews RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com RewriteRule
My .htaccess file is as follows: Options -Multiviews RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com RewriteRule
my .htaccess file contains the following RewriteCond %{HTTP_HOST} ^www\.mydomain\.org\.in [NC] RewriteRule ^(.*)$ http://mydomain.org.in/$1 [R=301,L]
The following .htaccess file does not work: SSLrequireSSL RewriteEngine on RewriteCond %{HTTP_HOST} !^secure\.neuralfutures\.com [NC]
This is my htaccess file Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php
I have an htaccess file as follows: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f
I have a .htaccess file with follow content: Options +FollowSymLinks RewriteEngine on RewriteRule ^produto/([a-z0-9-]+)/([0-9]+)/?$
I have a .htaccess file: RewriteEngine On DirectoryIndex control.php Options +FollowSymlinks RewriteBase / RewriteCond
my htaccess file is that: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}
In my .htaccess file I have a set of rules as follows: RewriteRule ^dir/page1$

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.