This block combined tells the server that if the request doesn't point to an existing file or directory, then re-route it to index.php. Your later rewrite rule can't be reached. Put it earlier.
Could you post again what you are using. I moved the line beneath the RewriteBase and it worked fine. I would suggest finishing the line with [L] if you aren't looking to further process the URL.
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;
So far having no luck though - any tips?
Your code loses the demos part in the regex. You need to include it.
$1 will read FILENAME.PHP, so the final URL becomes /wp-content/themes/themename/FILENAME.PHP.
Try:
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;
This block combined tells the server that if the request doesn't point to an existing file or directory, then re-route it to index.php. Your later rewrite rule can't be reached. Put it earlier.
@benwalker Hmm, sadly that doesn't work either.
Could you post again what you are using. I moved the line beneath the RewriteBase and it worked fine. I would suggest finishing the line with [L] if you aren't looking to further process the URL.
Ah! That did it, moving it below the Rewrite base. Final completed version below;
Sorry -- I should have been more specific when I said "put it earlier" :-)
I'm glad you've got it working.
No worries - thanks for your help mate, it was driving me nuts.