Forums

Give help. Get help.

  • # January 3, 2013 at 8:24 am

    Hey guys,

    I’m trying to rewrite a URL but not having much luck, it is a WordPress site, so not sure if that makes a difference.

    I’m trying to make it so someone could go to http://domain.com/demos/FILENAME.php

    The actual file path would be http://domain.com/wp-content/themes/themename/demos/FILENAME.php

    I’ve tried a few so far like;

    RewriteRule ^demos/(.*) /wp-content/themes/themename/$1

    So far having no luck though – any tips?

    # January 3, 2013 at 9:11 am

    Hi mate,

    Ah that was a typo when I created the thread – I was already doing your changed one, no luck unfortunately.

    Here’s what I have inside the HTAccess file;

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    RewriteCond %{HTTP_HOST} !^codeboxers.com$ [NC]
    RewriteRule ^(.*)$ http://codeboxers.com/$1 [L,R=301]
    RewriteRule ^demos/(.*) /wp-content/themes/codeboxers/demos/$1
    # January 3, 2013 at 2:45 pm

    @benwalker Hmm, sadly that doesn’t work either.

    # January 3, 2013 at 3:24 pm

    Ah! That did it, moving it below the Rewrite base. Final completed version below;

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^demos/(.*) /wp-content/themes/codeboxers/demos/$1 [L]
    RewriteRule ^index.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    RewriteCond %{HTTP_HOST} !^codeboxers.com$ [NC]
    RewriteRule ^(.*)$ http://codeboxers.com/$1 [L,R=301]

    # END WordPress

    # January 3, 2013 at 3:35 pm

    No worries – thanks for your help mate, it was driving me nuts.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag