Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Josh Alling](https://uploads.teamtreehouse.com/production/profile-photos/512652/micro_PortfolioPic.jpg)
Josh Alling
17,172 PointsLightbox stopped working after adding a rewrite rule
The homepage of a portfolio website I am working on has an animation on it, but I didn't want the animation to run every time the homepage is refreshed (because the homepage is also the portfolio page). I used php and a $_GET["id"] to make it so that the page only loads the CSS animation if the get variable is not set. Then I used a rewrite rule so that the url is /portfolio/ rather than /?id=portfolio.
Unfortunately my Lightbox no longer works with the rewrite rule. It follows the link to the actual photo rather than load the Lightbox, so it seems like the preventDefault line is no longer functioning. I don't know a lot about Javascript so I don't even know where to start to get this fixed. I have removed the rewrite rule to make sure that was the issue, and it works just fine without it.
Has anyone else had this issue, and does anyone know how to fix it?
1 Answer
![Erik Nemesis](https://secure.gravatar.com/avatar/dd796f53d796ac6096c51700869507db?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Erik Nemesis
13,356 PointsI think this is because when using the rewrite rule, you actually rewrite your url to get rid of your GET parameters. Therefore your $_GET['id'] will always be unset. How did you check your GET variable? Also could you please post some code (use jsbin or codepen preferentially)