# Htaccess url rewrite help

**URL:** <https://forum.kirupa.com/t/htaccess-url-rewrite-help/271343>\
**Category:** Uncategorized\
**Created:** [September 22, 2008, 1:24am UTC](https://forum.kirupa.com/t/htaccess-url-rewrite-help/271343 "2008-09-22T01:24:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![svenski](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@svenski](https://forum.kirupa.com/u/svenski)\
**Post date:** [September 22, 2008, 1:24am UTC](https://forum.kirupa.com/t/htaccess-url-rewrite-help/271343/1 "2008-09-22T01:24:27Z")

</div>

I’m tring to do a simple htaccess rewrite for a directory of SWF files.

The requested URLs look like this:  
[http://mysite.com/swf/gallery/galleryid](http://mysite.com/swf/gallery/galleryid)  
[http://mysite.com/swf/movie/movieid](http://mysite.com/swf/movie/movieid)

And I would like those rewritten to:  
[http://mysite.com/swf/gallery.swf?id=galleryid](http://mysite.com/swf/gallery.swf?id=galleryid)  
[http://mysite.com/swf/movie.swf?id=movieid](http://mysite.com/swf/movie.swf?id=movieid)

I thought the rule would be simple, but for some reason it is not rewriting properly. It cuts off everything after the .swf (output: [http://mysite.com/swf/movie.swf](http://mysite.com/swf/movie.swf)), so I’m assuming there is something wrong with the question mark in my rule, but escaping it didn’t help. Here’s my rule, could someone help with this?

code:  
RewriteRule ^swf/(._)/(._)$ swf/$1.swf?id=$2 [L]
