Reputation: 241
I need some help with mod_rewrite rule in apache.
This module is installed and working, i have tested it with wordpress permanent links and it works fine.
Now i have another website where want to apply the url change.
my main domain : www.mydomain.com the current adress for my posts. www.mydomain.com/post.php?id=111 i need to change this adress to:
www.mydoman.com/year/month/post title here
EDIT! For example this works great for me
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^id=([^/.&]+)/?$
RewriteRule ^post\.php$ /%1? [NS,R=301,L]
RewriteRule ^([^/.]+)/?$ post.php?id=$1&redirect=no [NS,QSA]
but it only show www.mydomain.com/postID
Please any kind of help ?
Upvotes: 0
Views: 39
Reputation: 36957
You'll have to add the ID to your URL, there's just no other simple way to do it:
URL = www.mydoman.com/year/month/post-title/111
RewriteEngine On
RewriteRule ^.*/.*/.*/([0-9]*)$ post.php?id=$1 [L]
Upvotes: 2