![]() |
htaccess question
On one of my sites I run WordPress and have permalinks setup via mod_rewrite. Currently, the posts appear as directories like
http://www.domain.com/category/postname/ I know I could change the permalink structure in the script itself to postname.html - but then the pages indexed by SEs would return 404s all across the site. Is there a way to divert requests for directories to the virtual .html files as specified by the new rewrite rules? :helpme |
So
http://www.domain.com/category/postname/ would automatically 301 to http://www.domain.com/category/postname.html |
I am sorry but I can help on this matter...good luck with it!
|
Quote:
|
Bump for you.
|
try webmasterworld.com
They have a bunch of very knowledgeable people on the apache forum |
I searched for this:
http://www.google.com/search?sourcei...q=htaccess+301 and found this: http://www.tamingthebeast.net/articl...1-redirect.htm |
Haven't tested it, but something like:
Code:
RewriteEngine on |
Here's a handly little rewrite cheat sheet for you mod rewrite fans from some dude who apparently digs on jack daniels:
http://www.ilovejackdaniels.com/mod_...heat_sheet.png |
Quote:
|
psili, that code won't work, because .* matches everything 0 or more times and /? matches a character 0 times or once... so this code of yours would match
http://www.domain.com/category/postname.html also Code:
RewriteEngine on This is not tested also, so maybe there are errors in this too :) Note that the above code will work in .htacces only, to use it in httpd.conf you should add / right before the categories, like this: Code:
RewriteEngine on |
Quote:
tamingthebeast.net dam good one, explanes it the best I've ever seen. :thumbsup |
thanks for the info guys. The example I posted was rather specific, the solution I need will be a little more complex since I am looking into redirecting URLs in different subfolders, not just /categories/. But nonetheless, I can start with the info that was posted here.
|
Not a problem:
Code:
RewriteEngine on |
All times are GMT -7. The time now is 03:08 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123