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? 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. 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 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. Link to comment https://forums.phpfreaks.com/topic/194206-rewritebase/#findComment-1022149 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.