Drupal 301 redirects for matching paths without .htaccess

Solutions

In this case, I looked at @Arosboro's suggestion about using Global Redirect. This was a bit more than I actually required, as all I needed was a simple redirect for a particular page. What I did instead was implement a quick module which handled the redirect based on a regex match for the old URL.

function redirect_init() {
    if (isset($_GET['destination'])) {
        $destination = $_GET['destination'];
        unset($_GET['destination']);
    }

    $request_path = redirect_request_path();

    // If the request_path() matches an article, redirect to the new URL
    // for articles.
    if ($request_path) {
        drupal_goto($request_path, array(), 301);
    }
}


function redirect_request_path() {
    $path = ltrim(request_path(), '/');

    if (preg_match('/^article\/\d+$/', $path)) {
    $path_list = explode('/', $path);
    $timestamp = $path_list[1];
        return 'article/doi/10.7244/cmj-' . $timestamp;
    } else {
        return;
    }
}

Probably the Global Redirect module suits your needs.

You may have to implement the timestamp feature as a new token with a custom module.

Similar questions

htaccess 301 redirect everything except /admin
I have been scratching my head for almost half an hour already because of this. I don't know what I am doing wrong, might just be under my nose, but i just cant see it. Here's what I have on my .htaccess When I access example.com/admin, i am still redirected to newsite.com/admin.Can anyone please advise? Thanks!
Conditional .htaccess 301 redirect when file name contains "extra" and ".php" and "id=XYZ"
I am a non-technical person so kindly bear with me. I am trying to 301 redirect old files that return 404 errors such as the ones given below to my home page http://www.innovateonline.info/ : I am using .htaccess and the site CMS is Drupal. I cannot redirect all files ending in .php as some Drupal admin files might end in that extension. Is there a...
301 Redirect from former .htaccess stuck
I uploaded a new Drupal 7 site to my server. The former non-Drupal php site used a 301 redirect in .htaccess like this: The new .htaccess file contains none of the former Rewrite rules. The old one seems to be cached somewhere, and somehow that redirect is trapped. When I load the home page the template loads, but then it doesn't load the new site'...
Restricting blocks to certain URL paths without sub paths
How can it be achieved, to make a block appear for the URL path /foo/* but not for /foo/*/bar?
Drupal 7 .htaccess redirects
I'm trying to redirect some old urls to the new Drupal ones with .htaccess rules. This works But this gives me a Drupal error Is it possible to perform a redirect like this? The errors I get are My new rules begin before the Drupal rules of As suggested I have tried redirecting to non clean URLS. This works Redirect 301 /oldurl http://mysite.com/?q...
Redirects in Drupal for index.php and home in htaccess
I have been trying to create redirects for /home and /index.php to the site's base url. I have tried following rules in htaccess but without any effect Im new to it so kindly bear with me if its a trivial question for the experts Thanks in advance to the wonderful people here that are kind enough to help.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.