Jump to content

RewriteBase


jaymc

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.