Htaccess重写规则方法得到

时间:2015-07-01 13:18:17

标签: regex apache .htaccess mod-rewrite

我想要重写:

example.com/articles to example.com/?rt=articles

example.com/articles/some-title-here to example.com/?rt=articles&title=some-title-here

我的代码:

RewriteEngine on
Options -Indexes

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]

RewriteRule ^articles/(.*)$ index.php?rt=articles&title=$1 [L,QSA]

第一次重写规则它正在工作,但第二次不起作用......

1 个答案:

答案 0 :(得分:1)

这样做:

@interface AVRecorderDocument ()
    @property (assign) IBOutlet NSTextField *labelSpaceLeft;
@end

@implementation AVRecorderDocument
....

-id(init){
...
    DASessionRef sessionDA = DASessionCreate(kCFAllocatorDefault);
    DARegisterDiskAppearedCallback(sessionDA, kDADiskDescriptionMatchVolumeMountable, diskAppearedCallback, 0);
    DASessionScheduleWithRunLoop(sessionDA, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
...
}


static void diskAppearedCallback(DADiskRef disk, void* context)
{
    CFDictionaryRef description = DADiskCopyDescription(disk);
    NSLog(@"Disk appeared: %@", description);
    NSLog(@"Disk Name: %@", CFDictionaryGetValue(description, CFSTR("DADeviceModel")));

//  [_labelSpaceLeft setStringValue:[NSString CFDictionaryGetValue(description, CFSTR("DADeviceModel"))]];


    CFRelease(description);
}
...
@end