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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:04:06+00:00 2026-05-13T12:04:06+00:00

This is my htaccess file RewriteBase / RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1

  • 0

This is my htaccess file

RewriteBase /

RewriteCond %{HTTP_HOST} ^example.com [NC] 
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] 

RewriteCond %{REQUEST_URI} !^/chat/
RewriteCond %{REQUEST_URI} !^/m/
RewriteCond %{REQUEST_URI} !^/__admin/
RewriteCond %{REQUEST_URI} !^/gzip_headers.php
RewriteCond %{REQUEST_URI} !^/phpfreechat/
RewriteCond %{REQUEST_URI} !^/_temp/


RewriteRule ^.+\.php$ index.php [L]

RewriteRule ^.*\.css gzip_headers.php [L]
RewriteRule ^.*\.js gzip_headers.php [L]

RewriteRule ^classifieds/ /index.php [L]

RewriteCond %{REQUEST_URI} !^/movies/.
RewriteRule ^movies/ /index.php [L]

RewriteCond %{REQUEST_URI} !^/games/.
RewriteRule ^games/ /index.php [L]

RewriteRule ^jntu/ /index.php [L]
RewriteRule ^news/ /index.php [L]

My idea behind this basically is,

  • forward everything to public_html/index.php (except some directories)
  • forward all js and css to gzip file, ( i am doing this basically because im not jsut gzipping them but also compressing in tha phpfile)
  • the problem is when I load images from subdirectories the are redirected to index.php as well, so just creating conditions for those directories and storing images in them like RewriteCond %{REQUEST_URI} !^/games/.

I would like to make it simple to do stuff like this

  • forward everything to index.php (except some conditions on top)
  • forward css and js to gzip file
  • load images and flash and some other mime types straight away only if they exists. (jpg|gif|png|swf|flv|mp4|3gp|mp3|zip|rar|exe)

Something like logical AND REQUEST_URI and -f flag I guess

  • 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-13T12:04:06+00:00Added an answer on May 13, 2026 at 12:04 pm

    Try these rules:

    RewriteCond %{HTTP_HOST} =example.com [NC]
    RewriteRule ^ http://www.example.com%{REQUEST_URI} [L,R=301]
    
    RewriteRule .*\.(js|css)$ gzip_headers.php [L]
    
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .+\.(jpg|gif|png|swf|flv|mp4|3gp|mp3|zip|rar|exe)$ - [L]
    
    RewriteCond %{REQUEST_URI} !^/(gzip_headers|index)\.php$
    RewriteCond %{REQUEST_URI} !^/(chat|m|__admin|phpfreechat|_temp)/
    RewriteRule ^.+\.php$ index.php [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in my htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} !^www.example.com$
I have this htaccess code: RewriteEngine on RewriteBase /xm/ RewriteCond %{REQUEST_URI} !^/index.php$ RewriteRule ^([a-z0-9]*)\.php$
I have got this .htaccess file: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond
I want to redirect http://www.example.com to http://example.com via .htaccess. I've found and tried below
I'm redirecting this URL: http://mydomain.com/expandyourtaste Using this .htaccess file: #Expand your tastes redirects Redirect
My .htaccess file is: Redirect 301 http://domain.com/news/articles?dtMain_start=150 http://domain.com/news/articles Redirect 301 http://domain.com/news/articles?dtMain_start=160 http://domain.com/news/articles Redirect 301
I have DocumentRoot /var/www/test in my .htaccess file. This is causing the apache server
When I set my WordPress site's address (URL) setting to = http://www.example.com , then
I have the following htaccess to redirect users from www.mysite.com or http://mysite.com to http://mysite.com/subfolder
I want to rewrite an url like this: http://www.piata-bio.ro/presa-bio.php?var1=http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNHmU7U7bXtlH9Lo8dXfBs64PqxgbA&url=http://www.eva.ro/divertisment/stiri/un-nou-concept-de-magazin-articol-35491.html to something like this :

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.