Title: Mod Rewrite question
Last modified: August 19, 2016

---

# Mod Rewrite question

 *  Resolved [ahirai](https://wordpress.org/support/users/ahirai/)
 * (@ahirai)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/mod-rewrite-question-2/)
 * Suppose I have a blog article at:
    [http://www.example.com/blog/2009/02/my-article/](http://www.example.com/blog/2009/02/my-article/)
 * I have a newsletter. The newsletter software adds tracking parameters to the 
   URLs embedded in the newsletter. So, if I try to link to the article referenced
   above, the newsletter software ends up sending a link to something like:
    [http://www.example.com/blog/2009/02/my-article/?w=el&x=302692&y=3&z=952a7ad62d](http://www.example.com/blog/2009/02/my-article/?w=el&x=302692&y=3&z=952a7ad62d)
 * When a newsletter recipient clicks on the link, WordPress returns an error stating“
   Sorry, but you are looking for something that isn’t here.”
 * Question: How do I get WP to display the correct page?
 * I’ve tried adding variations on the following line to my .htaccess file, but 
   without any success:
 * RewriteRule ^http://www.example.com/blog/2009/02/my-article/.+$ [http://www.example.com/blog/2009/02/my-article/](http://www.example.com/blog/2009/02/my-article/)
 * [Note: I’ve tried doing this in the .htaccess files in both the root directory(
   example.com/) and in the blog directory (example.com/blog)]
 * Please help!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [ahirai](https://wordpress.org/support/users/ahirai/)
 * (@ahirai)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/mod-rewrite-question-2/#post-977182)
 * Note: I’ve also tried the following rule:
 * RewriteRule ^/blog/([0-9]{4})/([0-9]{2})/([a-z-]+)/(\?[=\&a-z0-9/\.:-]+)$ /blog/
   $1/$2/$3/ [R]
 * This doesn’t seem to do the trick either. I suspect the problem might have to
   do with the order in which rules appear in the .htaccess file. Maybe the rule
   I’m trying to enter is being overridden by something else.
 * The .htaccess file in my /blog directory contains the following:
 * # BEGIN WordPress
    <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/
   RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule./
   blog/index.php [L] RewriteRule ^/blog/([0-9]{4})/([0-9]{2})/([a-z-]+)/(\?[=\&
   a-z0-9/\.:-]+)$ /blog/$1/$2/$3/ [R] </IfModule> # END WordPress
 * Please advise…
 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/mod-rewrite-question-2/#post-977183)
 * I don’t know about your code or issues in particular, but in general, you should
   keep your own added code outside of the WordPress section.
 *  [amdoolittle](https://wordpress.org/support/users/amdoolittle/)
 * (@amdoolittle)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/mod-rewrite-question-2/#post-977203)
 * Try the following in your /blog/ subdirectory .htaccess:
 *     ```
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond %{REQUEST_URI} ^/blog/([0-9]{4})/([0-9]{2})/([a-z0-9-]+)/
       RewriteRule ^(.*) /$1? [R]
       </IfModule>
   
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /blog/
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /blog/index.php [L]
       </IfModule>
       # END WordPress
       ```
   
 * The end result is your same query line, without the querystring (? and beyond).
 *  Thread Starter [ahirai](https://wordpress.org/support/users/ahirai/)
 * (@ahirai)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/mod-rewrite-question-2/#post-977204)
 * It works!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Mod Rewrite question’ is closed to new replies.

## Tags

 * [mod-rewrite](https://wordpress.org/support/topic-tag/mod-rewrite/)
 * [parameter](https://wordpress.org/support/topic-tag/parameter/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [ahirai](https://wordpress.org/support/users/ahirai/)
 * Last activity: [17 years, 3 months ago](https://wordpress.org/support/topic/mod-rewrite-question-2/#post-977204)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
