I have an issue with creating a rewrite rule.
We have a WordPress install and we need to server a mix of static and dynamic content.
Say we have a page in wordpress of /support, it’s the landing page for forums, documentation etc.
Our documentation is generated outside of wordpress and we’d like it to be served from /support/documentation.
How would we ho about this? I’ve tried a few options the closest being adding the documentation in a seperate folder:
RewriteRule ^support/documentation(/.*)?$ /support-4-0/Documentation$1 [NC,L]
The trouble here is that the support-4-0 folder is still served by Apache leading to issues with duplicated content. Is there a better way to go abut this?
3
Answers
If you do not have a problem with storing the
support-4-0
folder in a location other than your site’sDocumentRoot
folder, you can use theAlias
feature.From Apache Documentation:
Alias syntax:
You need to specify additional sections which cover the destination of aliases. This is example directory config:
PS: Reference directory tree for above configuration :
If you want to stop user to access
support-4-0
you can redirect your user from that page to your new support page which starts fromsupport
.You can use below,
Make sure the apache mod_rewrite module is installed. Then, use something like this in your apache config, virtual host config, or (less desirable) .htaccess file: