4

I'm converting a Zen Cart site to Ubercart and need to keep Zen Cart’s ugly URLs for SEO purposes. The site is top ranking on Google Search for their keywords and I’ve been advised that changing the URLs to something cleaner could potentially hurt rankings.

I wonder if there is any way to give a node a URL like http://example.com/index.php?main_page=about_us?

By default Drupal encodes special characters, so it tries to make my URL /index.php%3Fmain_page%3Dabout_us and I also get a 403 error.

  • You can create your own custom url using url aliases settings in drupal for an existing content – Amrendra Kumar Mar 10 '16 at 8:03
  • 1
    Drupal would not let you set something like index.php?main_page=about_us as path alias, though. – kiamlaluno Mar 10 '16 at 8:14
6

My advice would be to keep Drupal's URL handling as is and simply configure a set of redirects with code 301 in your .htaccess.
That way your URLs will maintain their google ranking.

A useful quote:

"Be aware that when moving a page from one URL to another, the search engines will take some time to discover the 301, recognize it, and credit the new page with the rankings and trust of its predecessor. This process can be lengthier if search engine spiders rarely visit the given web page, or if the new URL doesn't properly resolve."

This is an excerpt from https://moz.com/learn/seo/redirection, I would recommend reading that whole article, it's quite useful.

And an example of such a redirect:

RewriteCond %{QUERY_STRING}     ^main_page=about_us$     [NC]
RewriteRule ^.*$             /node/1234     [NC,L,R=301]

Hope this helps!

1

I agree with one of the comments below the question like "Drupal would not let you set something like index.php?main_page=about_us as path alias ...". However, you could use the the Rules module to get this to work, together with the Rules URL Argument module. It will make the value of the URL argument available as new variable to Rules. Here is a quote about the Rules URL Argument module (from its project page):

... provides two rules conditions based on URL arguments:

  • check if a URL argument is present.
  • compare the value of an URL argument.

It also provides an action that makes the value of an URL argument available as new variable to Rules.

The newly provided Rules actions and conditions can be found under the "URL Argument" conditions and actions groups in the rule configuration interface.

For an example of how to use it, refer to Comment # 3 in issue # 1686360 which is about "Pass an amount to the url, ie; site/content/node-title?amount=10 or /node-title?=amount:10". Here is the relevant part of it:

  • add a "Check if URL argument exist" condition to your rule and set the "ARGUMENT" value to "amount".
  • add "Provide URL argument value" action to the rule and set "URL ARGUMENT NAME" value to "amount" and in the "Provided variables" section "ARGUMENT FROM URL - Variable name" to e.g. "amount_from_url".

You will now be able to use the amount value as a variable "amount-from-url" for other actions in this rule.

  • 2 large, bulky and anti-performant modules just to perform a single redirect? Absolutely don't do this, use the tools that were built for the job. – Clive Jun 7 '17 at 7:12
0

You can disable clean URL's of your Drupal website on the following link:

http://example.com/admin/config/search/clean-urls

Further if you want some help you can go through the community documentation about Disabling clean URLs.

Besides that for the SEO purpose you should use your content with keywords and meta tags, there are several modules available for SEO under https://www.drupal.org.

One of the most popular modules for SEO is Metatag module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.