- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
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?
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
@benwalker Hmm, sadly that doesn’t work either.
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
No worries – thanks for your help mate, it was driving me nuts.