简体   繁体   中英

Drupal 7 - RewriteRule in htaccess file with parameters

i have a question about writing a rule in the htaccess file which is located in the root directory of drupal. We use the Drupal 7 version.

We want to write a rule for the url that when i go to the page "/newpage/1/name" it should target the "/oldpage?id=1&user=name". So the targetpage is a page which is created in drupal itself (a added content from a contenttype).

But i always get the same "Page not found"-Error. I can access the "/oldpage" by the way

I tried some rules about simply rewriteUrl without any parameters (to make a start). But it also didn't work for me. Here my try:

RewriteRule ^oldpage /newpage [L,R=301]

This line is below this part:

  # Pass all requests not referring directly to files in the filesystem to
  # index.php. Clean URLs are handled in drupal_environment_initialize().
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

So are there any special rules for writing rules in the htaccess file in drupal? (maybe especially in version 7) or what is wrong on my code?

阅读本网站指南 ,我将尝试以下行

RewriteRule oldpage?id=(.*)&user=(.*)/$ /newpage/$1/$2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM