0

I created a little web app that allows people to keep content on a page. They can specify the url of the page. Instead of accessing their page like this: http://example.com/stuff?page=their_url I want the url to be like this: http://example.com/stuff/their_url

But I can't figure out how to direct a dynamic url to a Drupal page. I've even tried Apache redirects, but I can't get that working either. I keep getting 404's.

I'm willing to use Apache rewrites to get to the right page.

I'm willing to point to a regular PHP file on the server and bootstrap Drupal, but so far I haven't been able to get that working.

I'm willing to put PHP code into a Drupal page.

I really don't want to write my own Drupal module, so if you want to offer some Drupal code, please tell me where to use it.

I'm willing to use a Drupal 7 module if you know of any.

Thanks a lot!

-- Magmatic

0

i think that you can use the : function drupal_goto

but not sure if that is for your case.

  • Thanks, but this is an external redirect. I want an internal redirect (so the user's browser doesn't see it). – Magmatic Oct 2 '14 at 15:59
0

So after a few hours I finally got something working. This is it:

In my .htaccess file I have a rewrite:

RewriteRule ^fz/(.*) fz.php?page=$1 

Then in my fz.php file I have this:

<?

$_GET["q"] = "filezone";

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

menu_execute_active_handler();

I have a Drupal page that I want to display. It's url is set to be "filezone". In fz.php, it displays this page. And on that page I can get the "page" value with $_GET["page"].

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.