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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:20:47+00:00 2026-06-05T05:20:47+00:00

Trying to figure out how to write my httaccess to let me have it

  • 0

Trying to figure out how to write my httaccess to let me have it so my urls are ‘www’ free and allow me to have a slug style setup for ‘friendly’ urls. I seem to keep writing myself into an internal 500 error though. That or it doesn’t seem to carry over the extra stuff. extra stuf being anything from .com/ over ie mydomain.com/hello/world

RewriteEngine On
Options +FollowSymlinks -MultiViews
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.mydomain.com [NC]
RewriteRule ^(.*)/?$ http://mydomain.com/index.php?r=$1

Overall goal take URL in either of these 2 fashions

http://mydomain.com/hello/world

http://www.mydomain.com/hello/world

and have it translate to

http://mydomain.com/hello/world to the front end but on the backend be the equivalent to http://mydomain.com/index.php?r=hello/world

also I would like to apply conditions where if a file exists, or folder exists, or whatever exists stop the rewrite cold. I know this is possible well without the removal of the www part, not sure with that part, as I used to once have an htaccess file that I could do this with, but I have lost that file and its been far to long since ive played with htaccess to remember how i did it in the first place.

  • 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-05T05:20:50+00:00Added an answer on June 5, 2026 at 5:20 am

    This will forward www to non-www site. Also take care of the index.php.

    RewriteCond %{HTTP_HOST} ^www\.domain\.com$
    RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
    RewriteRule ^(.*)$ index.php?r=$1 [QSA,L]
    

    You can also add the following two lines. Like this if you have any css or images it will not rewrite them to index.php:

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?r=$1 [QSA,L]
    

    This is not tested but a general guidance.

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

Sidebar

Related Questions

I'm trying to figure out how to write a 'not in' style query in
I have been trying to figure out how to write a simple program to
Trying to figure out how to write a jquery formula that will sum all
I've been trying to figure out how to write this regular expression. It is
I'm trying to figure out how to write a code which takes an input
I am trying to figure out how to write the following SQL in the
i am trying to figure out how to write a linq query that will
I'm trying to figure out how to write a function that programmatically retrieves a
I am using NHibernate, and am trying to figure out how to write a
trying to figure out how to write the following in CoffeeScript: var foo =

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.