Jump to content

RewriteBase


jaymc
 Share

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
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
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.