Forum Moderators: phranque
Example:
site.com/?p=213
301 to site.com/date/time/new-friendly-url/
site.com/?p=214
301 to site.com/date/time/new-friendly-url2/
etc. etc.
I notice there is [QSA,L] after most of the mod-rewrite stuff
I've seen [301,L] used before but have no clue what this means, and it didn't seem to work how I had hoped.
Really wanna do a site-wide sweeping 301 to the appropriate places in the very near future before I start hitting SE problems.
Here's an example of what's in my .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^site.com
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=55]
RewriteRule ^(about-red-fuzzy-widgets)/trackback/?$ /index.php?pagename=$1&tb=1 [QSA,L]
RewriteRule ^(about-widget-fuzzy-stuff)/feed/(feed¦rdf¦rss¦rss2¦atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
RewriteRule ^(about-fuzzy-widget-stuff)/(feed¦rdf¦rss¦rss2¦atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
</IfModule>
Change this:
RewriteRule ^(about-red-fuzzy-widgets)/trackback/?$ /index.php?pagename=$1&tb=1 [QSA,L]
To this
RewriteRule ^([^/]+)/trackback/([0-9]+)\.html$ /index.php?pagename=$1&tb=1 [QSA,R=301,L]
Then change your friendly URL's to include the page or other variable you will need for the php file to work correctly:
/about-red-fuzzy-widgets/trackback/241.html
The .html is optional, I use it. The rules with two variables will need to have both instances in the new friendly URL.
I would change this:
RewriteRule ^(about-widget-fuzzy-stuff)/feed/(feed¦rdf¦rss¦rss2¦atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
To this:
RewriteRule ^([^/]+)/feed/([a-z]+)/([0-9]+)\.html$ /index.php?pagename=$2&feed=$3 [QSA,NC,R=301,L]
(+) 1 or more of the characters.
[^/] anything that is not a /
QSA passes info as a query string.
NC designates No Case to verbiage.
R=301 Permanent Move Redirect.
Justin