I’ve been using a drupal 4.7 installation for many years, and have had a recent problem crop up. That is, the rewritten URLs are now displaying these characters: ?q= in every drupal generated URL as follows: http://sitename.com/?q=path/alias , where before it would be: http://sitename.com/path/alias .
My best guess as to why this might be happening, is that I recently began using some PHP code to add context-specific link styling within a few sideblocks. Here’s the code:
<?php $alias= $_GET['q']; ?>
<a <?php $pos=strpos($alias,"1234"); // node number
if(!$pos == false) {
echo 'style="color:black"';
} ?> href="internal/link/alias">Internal Link</a>
Or more recently:
<?php $path = isset($_GET['q']) ? $_GET['q'] : '<front>';
$alias = url($path, array('absolute' => TRUE)); ?>
<a <?php $pos=strpos($alias,"internal/link/alias");
if(!$pos == false) {
echo 'style="color:black"';
} ?> href="internal/link/alias">Internal Link</a>
Could this be the problem? If so, any ideas about fixes?
I don’t think your snippet is causing it. It only reads from the database; it does not make changes to URLs. Is mod_rewrite still enabled? This may be caused by a recent change to the server config. Check the output of
phpinfo().By the way, the option
$absoluteforurl()is passed as a separate argument in Drupal 4.7, not in the$optionsarray. Your call should be: