Results 1 to 4 of 4

Thread: Htaccess Problem

  1. #1
    Join Date
    Apr 2012
    Posts
    81
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Htaccess Problem

    When i upload this code to my website, it Gives me 500 Internal Server error.
    Can anyone help me to solve it. ?

    Is it the Problem of any of the Apache service ?
    Thanks in Advance for Any help.


    Code:
    <IfModule mod_rewrite.c>
    
    RewriteEngine On
    RewriteBase /mysite/
    
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    
    </IfModule>
    
    <IfModule !mod_rewrite.c>
        ErrorDocument 404 /index.php
    </IfModule>

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,998
    Thanks
    16
    Thanked 313 Times in 311 Posts
    Blog Entries
    12

    Default

    What if you just try;
    Code:
    RewriteEngine On
    RewriteBase /mysite/
    
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Mod rewrite is always tricky. 500 errors come up whenever there is a bug in the code. I don't see any obvious problem just looking at it (not that I'm great at reading these-- I find them to be confusing), but I'd bet there is a typo or something that doesn't line up with your system. For example, there might end up being an endless loop somehow. When debugging these I usually just try a lot of combinations and hope that something works. One issue can be the [L] rules that make it stop-- maybe they're not being properly activated. Note that once in a while the server can get "stuck" so you have to wait before trying again. Be careful when using .htaccess-- it can really mess things up (although deleting the .htaccess file via FTP will almost always restore it).

    Maybe someone else will be able to see the problem.

    Have you tried writing out an explanation in plain English for each line to be sure that it matches the files on your server?

    Edit: Beverley and I cross-posted. I agree with her that you might want to try a simpler version. I've never needed to use those extra commands, but your server could require them.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Aug 2013
    Location
    Brisbane, Australia
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb

    Have you updated your path parameters in your config files on your website?
    On some hosts this will point your main domain name to your /mysite/ folder, but your url would still read www.mydomain.com/mysite/index.php
    In other words, if you type the url www.mydomain.com, the browser will be directed to www.mydomain.com/mysite/index.php

    Not all web host allow the redirection of your main domain to a folder.
    A way around this is to add an additional domain name to your account, and make that the main account domain.
    Then set the domain that you would like to use for your website as an add-on domain.
    Add-on domains are usually allowed to be pointed directly to a folder on your site.

    This would mean that when you set your add-on domain to start in /mysite/ folder, and you would not have to fiddle with the htaccess file at all.
    So this way when you type the url www.add-on-domain.com, automatically it will be started in /mysite/ folder, and the url in the browser will read www.add-on-domain.com/index.php

    You can than use htaccess to redirect your mydomain.com to add-on-domain.com

    Hope this helps

    Goshawk
    Last edited by Goshawk; 08-29-2013 at 12:27 PM. Reason: spelling mistakes

Similar Threads

  1. .htaccess rewrite url problem
    By robert_gsfame in forum Other
    Replies: 3
    Last Post: 08-27-2010, 05:07 AM
  2. Problem with an htaccess
    By Keleth in forum HTML
    Replies: 0
    Last Post: 07-22-2009, 04:10 AM
  3. .htaccess problem
    By sir_yunus in forum PHP
    Replies: 0
    Last Post: 04-19-2008, 08:22 PM
  4. .htaccess problem
    By feeleash in forum Other
    Replies: 11
    Last Post: 05-19-2006, 05:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •