Results 1 to 2 of 2
  1. #1

    Need of other kind of htaccess redirect when Drupal in sub-folder?

    I have Drupal installed in a (cms) sub-folder and to hide the /cms/ I found the "right" code further below which works, BUT, I also want to make re-directs of old pages simple 301 redirects, but I end up in a non-existing place like this (with PUBLIC_HTML = the actual web-site):

    PUBLIC_HTML/en/pricing-order?q=en/pricing.html

    rather than the intended:
    PUBLIC_HTML/en/pricing-order

    with the code below:

    Code:
    Redirect 301 /en/pricing.html PUBLIC_HTML/en/pricing-order
    
    # Serve Drupal from sub directory in web root
    RewriteRule ^$ cms/index.php [L]
    RewriteCond %{DOCUMENT_ROOT}/cms%{REQUEST_URI} -f
    RewriteRule .* cms/$0 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* cms/index.php?q=$0 [QSA]
    Since "q=" seems to be needed in order to get the page served right from its sub-folder, I wonder if there's any suggestion of other redirects to use?

  2. #2

    Found the answer

    You apparently have to use mod_rewrite, as mod_alias is not sufficient when you have this other Rewriterules, so instead of:
    HTML Code:
    Redirect 301 /cool public_html/right-place/cool
    We must use:
    HTML Code:
    RewriteRule ^cool$ public_html/right-place/cool [L,R=301]

Similar Threads

  1. Redirect to folder based on login info with .htaccess
    By stooley in forum Hosting Security and Technology
    Replies: 1
    Last Post: 08-03-2007, 02:01 AM
  2. Redirect from one folder to another via .htaccess ?
    By Joel Theodore in forum Hosting Security and Technology
    Replies: 3
    Last Post: 01-13-2007, 11:37 AM
  3. Redirect Folder and contents with htaccess
    By registercheaper in forum Programming Discussion
    Replies: 2
    Last Post: 08-31-2006, 10:26 PM
  4. htaccess to redirect all pages in a folder to a single page
    By SmartTux in forum Hosting Security and Technology
    Replies: 6
    Last Post: 09-22-2005, 06:32 AM
  5. Folder redirect with htaccess
    By ericmix in forum Hosting Security and Technology
    Replies: 0
    Last Post: 09-19-2005, 04:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •