I've got the following 2 lines of code in my .htaccess that is used to create clean URLs. RewriteRule ^(.*)/$ index.php?action=cat&name=$1 RewriteRule ^(.*)/(.*).php$ index.php?action=article&catname=$1&title=$2 These 2 lines will produce URLs as follows. The category and article titles are in the MySQL database. Category: www.example.com/category/ Article: www.example.com/category/article-name.php The problem is that it doesn't like it when there are ? in the article title. Example: www.example.com/category/what-does-this-do?.php That just doesn't work and gives a 404. What should I add to the .htaccess to remove any ? from the URL? Thanks!
You should remove the ? from the generated URL rather than try and force your rewrites to work round it. The ? means the start of the query string - for instance with index.php?action=cat&name=pie, your server will look for a script named index.php and pass action=cat&name=pie to the script as GET values. The same thing applies here: a request for category/what-does-this-do?.php will look for a file named what-does-this-do in the category directory with '.php' as the query string.