Hi

I have a problem with Clean URLs since upgrading to Drupal 5.1.

My root site URL is www.example.com/drupal/

As an example, on the page www.example.com/drupal/node/51

I have an internal link such as:

click here

But if the user clicks on this link, the browser tries to go to:

www.example.com/drupal/node/node/28

which is not a page, so it goes to the home page instead.

If I start from the page URL www.example.com/drupal/?q=node/51 then the links work fine.

All my links are set up like this. I'm sure they used to work. Can anyone see what I am doing wrong?

(I have enabled Clean URLs after running the server check and the Path module is enabled)

Bill.

Comments

billtubbs’s picture

Sorry, the html code for the internal link did not show up in the above bug report. anyone know how to include html code in a bug report without it being pre-processed?

Let me try this:

<a href="node/28">click here</a>

kbahey’s picture

Did you uncomment this line in .htaccess?

#RewriteBase /drupal

billtubbs’s picture

Thanks. No that line was commented.

However, I just uncommented it and it doesn't seem to have solved the problem. Are there other things that need to be checked to get this working? I thought I could just enable the two modules and be in action. I'll re-read the help page on clean URLs. Any other things I should be doing?

I am writing the link properly am I: <a href="node/24">click here</a>

billtubbs’s picture

As far as I can see the problem is with the way I am writing link URLs. The method shown above works fine except when Clean URLs are activated. Then the extra '/' throws the relative path off.

Is there no way of specifying short paths such as this when putting an local link on a page? Or do I have to write out the full absolute URL like this:

<a href="http://www.example.com/drupal/node/40">click here</a>

I can't see anything about relative path referencing. Anybody know? It seems silly with this excellently simple Clean URL system not to be able to use it for links.

jonny_noog’s picture

Hello,

Just wanted to report that I too am experiencing this issue when attempting to use clean urls with internal links created within pages. If I create a link within a page like:

<a href="node/1">link</a>

Then the actual link will become:

http://www.somesite.com/node/node/1

But if I create a link like:

<a href="/node/1">link</a>

Then I end up with the correct:

http://www.somesite.com/node/1

I am very new to Drupal, so I really don't know exactly what is going on here but it seems like the problem is related to the link being somehow treated as relative unless one adds the initial "/" into the link at the start. If any guru feels like expanding my knowledge of this issue, that would be awesome.

I have tried playing around with RewriteBase in my .htaccess, but it doesn't seem to make a difference, I have also tried setting $base_url in settings.php, but this also doesn't seem to make a difference. Other than this issue, clean urls seem to be working as expected.

I am using a fresh install of Drupal 5.1 with Apache 2.2.4/PHP 5.2.3, Drupal is running on it's own virtual host under Apache.

ricabrantes’s picture

Status: Active » Closed (fixed)

Issues resolved, Closed..

Zorga Lina’s picture

It seems that once you enable "clean URLs", the url() function will generate a fully-qualified URL based on the Drupal MENU, not your actual file structure.
For example if part of your content on a node (call it 'MYPAGE') is a link which references a .pdf file, with "clean URLs" enabled you will get the url "http://host:port/root/MYPAGE/myfolder/mydoc.pdf" . The pdf files are in root/myfolder, and with relative urls I had just Using Pathfilter, One should not change .htaccess RewriteBase, it won't help anyway. Asking users to add Rewrite rules to .htaccess seems excessive. Changing $base_url as the above post mentions also doesn't help.