skip to Main Content

i have two directories on a managed server system. One with a Drupal installation and another with a wordpress installation.

/web/drupal/
/web/wordpress/

The domain pointed to the drupal installation with a htaccess in it.
Now i want to specify special urls e.g. http://example.com/special/variablename in the htaccess where changed the root direcoty from the drupal installation to the wordpress root directory.

Is that possible?

I have tried many configuration in the current htaccess but no one works and all direct me to the actual drupal installation.

2

Answers


  1. Chosen as BEST ANSWER

    After some research i found out in that scenario its not possible to solve it like this way with the htaccess.

    For me is the solution now to create a nginx proxy on another system with the original domain and change the two others to subdomains. With that i can create a config to solve this special case of handling.


  2. If I’ve understood your question correctly, you wish to have the following flow:

    • User visits http://example.com/special/variablename (the example.com domain currently points to /web/drupal/).
    • Instead of accessing the resource in /web/drupal/, the user is redirected to a resource in /web/wordpress/.

    Option 1: Without Access to Domain Config File

    There is no way to achieve the desired functionality exactly as you want it without access to the domain config file.
    This is because the htaccess file works within the context of /web/drupal/; it does not know about any other directories outside its current directory. As such, it would not be possible to change the root directory. You would only be able to point to a sub-directory of /web/drupal/.

    To achieve something similar to what you wish, you could set up a subdomain that points to /web/wordpress/.
    Once that is done, set up a redirect to the subdomain in your htaccess file that directs a user to http://sub.example.com.

    A redirect would look something like this:

    RewriteEngine On
    RewriteRule ^special/variablename/(.*)$ http://sub.example.com/$1 [L,R=301]
    

    You can refer to this article or the Apache documentation for more details on redirecting.

    Option 2: With Access to Domain Config File

    If you have access to the config file for the example.com domain, then you can use the Alias directive (refer to the Apache documentation) to point to the /web/wordpress/ directory.

    This would look something like this:

    Alias "/special/variablename/" "/web/wordpress/"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search