By Yura Filimonov on
I have Drupal in a subfolder, /folder
I also use the Path module to specify custom page path, so it ends up with
custom-page-name
When I insert links to pages, I use
/custom-page-name
Naturally, it directs to domain.com/custom-page-name.
How do I make it redirect to domain.com/folder/custom-page-name without changing all the paths on the site? I plan to migrate to the root folder soon.
I have tried editing the base_url in the settings.php file and nothing.
I am guessing using .htaccess in the root folder is mute, as it'll redirect all non-Drupal pages as well.
Thanks.
Comments
Drupal in subfolder
I have a similar situation, where my Drupal site is in a subfolder, say www.mysite.tld/folder
The root, mysite.tld itself, contains a small htaccess file with this single line :
Redirect /index.html http://www.mysite.tld/myfolder/
That nicely brings my visitors to the Drupal site (without use of any specific modules). It also works well with URL aliases, didn't see any complications.
Indeed it would redirect all calls to mysite.tld to the subfolder so this might not be fully appropriate for your case.
Perhaps it's worth the experiment.
A.
I just started using Drupal
I just started using Drupal 5 on a test site which is in a sub directory with the Path module. I am having no problems whatsoever and I am extremely impressed with Drupal so far. I am going to have to start using it from now on.
I enter my urls without the first / and it works fine. If I put a /newurl I get an error because it automatically adds the trailing slash onto the end of the url before the /newurl causing it to be //newurl. So if I just use newurl as my path it works fine.
rrhode, while that works
rrhode, while that works when you don't have other subfolders in the root/subfolder, it will cause problems when you will.
For example, if I set the URL as 'custom-page-title' (in the page block) and try to visit right from the admin panel, it attempts to go to domain.com/folder/admin/custom-page-title, which doesn't exist.
Can anyone suggest a solution to this, please?
sollution
in the root htaccess file find:
# If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
# RewriteRule .* http://example.com/ [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /
# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
ad the name of the subfolder after RewriteBase /
for www.example.com/drupalinadir :
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /drupalinadir
thats it