1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Issues with .htaccess

Discussion in 'Apache' started by PoPSiCLe, Sep 15, 2014.

  1. #1
    Hi.
    I've never really gotten the hang of .htaccess, and right now I'm a bit stumped
    I had a working version, but after upgrading the hosting environment, it broke (maybe in part because of changes in the code as well).
    However, right now, I have a semi-working .htaccess, but a couple issues are still present.
    Here's the current .htaccess:
    
    #Gzip
    <ifmodule mod_deflate.c>
    SetOutputFilter DEFLATE
    </ifmodule>
    #End Gzip
    
    Options +FollowSymLinks
    Options -Indexes
    
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (css|script|uploads|webgfx|timesheet|translations|reports)/(.+)$ $1/$2 [N,QSA,L]
    RewriteRule ^(.*shiftlistreport)|^(.*skiftlisteoversikt)$ index.php?page=reports&subpage=$1 [L,QSA]
    RewriteRule ^(.*skiftlisteoversikt)$ index.php?page=reports&subpage=shiftlistreport [L,QSA]
    RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]
    
    ErrorDocument 404 /index.php?page=404
    
    <IfModule mod_expires.c>
    # Enable expirations
    ExpiresActive On
    # Default directive
    ExpiresDefault "access plus 1 month"
    # My favicon
    ExpiresByType image/x-icon "access plus 5 years"
    # Images
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    # CSS
    ExpiresByType text/css "access 1 month"
    # Javascript
    ExpiresByType application/javascript "access plus 1 year"
    </IfModule>
    
    Code (markup):
    This doesn't work (it works for redirecting and stuff, but it delivers an error on the page, and CSS and JS isn't loaded correctly.
    SEMrush
    If I change around the last RewriteRule a bit, so it looks like this:
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]
    RewriteRule (css|script|uploads|webgfx|timesheet|translations|reports)/(.+)$ $1/$2 [N,QSA,L]
    RewriteRule ^(.*shiftlistreport)|^(.*skiftlisteoversikt)$ index.php?page=reports&subpage=$1 [L,QSA]
    RewriteRule ^(.*skiftlisteoversikt)$ index.php?page=reports&subpage=shiftlistreport [L,QSA]
    
    Code (markup):
    it works, but the final redirects doesn't trigger at all.

    Could anyone tell me how I can achieve the functionality I need?
    Ie, I want "pretty urls" domain.com/something redirects to domain.com/index.php?page=something, and I want specific trigger-words to redirect further down the tree domain.com/shiftlistreport redirects to domain.com/index.php?page=reports&sub_page=shiftlistreport
    All the while while keeping CSS and scripts and such working, of course. Doesn't really seem to difficult, but I'm probably trying to do this the wrong way
     
    PoPSiCLe, Sep 15, 2014 IP
    SEMrush