jaymc Posted March 5, 2010 Share Posted March 5, 2010 I have the following <VirtualHost 87.117.x.x> UseCanonicalName Off DocumentRoot /mnt/codebase/monthly VirtualDocumentRoot /mnt/codebase/monthly/%-2/ RewriteEngine on RewriteBase / RewriteRule ^([^/\.]+)/?$ ?pageName=$1 [QSA] </VirtualHost> Because Im using dynamic vhost the rewrite rule will not work without RewriteBase / if I put this in .htaccess it works fine RewriteEngine on RewriteBase / RewriteRule ^([^/\.]+)/?$ ?pageName=$1 [QSA] But when I take it out of .htaccess and put into the vhost so it applies to all websites I get this error rewritebase: only valid in per-directory config files Im a bit stuck? Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/194206-rewritebase/ Share on other sites More sharing options...
trq Posted March 5, 2010 Share Posted March 5, 2010 Is this rewrite rule passing these optuions to an index.php file or something? Its not very clear. eg RewriteRule ^([^/\.]+)/?$ index.php?pageName=$1 [QSA] To get this rule to work within a virtualdocumentroot you would simply use... RewriteRule ^([^/\.]+)/?$ /index.php?pageName=$1 [QSA] No need for a RewriteBase directive. Quote Link to comment https://forums.phpfreaks.com/topic/194206-rewritebase/#findComment-1021785 Share on other sites More sharing options...
jaymc Posted March 5, 2010 Author Share Posted March 5, 2010 Yeh index.php but because of the dynamic vhost it needs rewritebase Quote Link to comment https://forums.phpfreaks.com/topic/194206-rewritebase/#findComment-1021966 Share on other sites More sharing options...
trq Posted March 5, 2010 Share Posted March 5, 2010 Yeh index.php but because of the dynamic vhost it needs rewritebase No, it needs to be pre-pended with a forward slash. That should be sufficient. Quote Link to comment https://forums.phpfreaks.com/topic/194206-rewritebase/#findComment-1022149 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.