I would like to write a url from
Original URL
www.xyz.com/folder/articles?id=1221
to rewrite URL
www.xyz.com/folder/article-title-1221.html
Would this be possible? I am wanting to creates dynamic pages based on the id in the url.
Thanks in advance
Try this:
RewriteRule folder/article-title-([0-9]+)\.html$ folder/articles?id=$1 [L]
Related
I want to rewrite the url using .htaccess
Here is my main url which will be accessed by public:http://example.com/watch?v=123456789
I want same values of get parameters but in new location:
http://example.com/index.php?v=123456789
How can i do this? Help will be appreciated! Thanks.
it could be something like.. (.htaccess at root level)
RewriteRule ^watch/?$ index.php [QSA,L]
The important thing is the QSA option ("QueryString Append")
Hope it helps!
I have searched for my specific htaccess redirect from dynamic url to static url but can't found proper one. So here is the question.
I want to redirect
www.example.com/directory/?year=2014&month=September
www.example.com/directory/?year=2014&month=October
www.example.com/directory/?year=2015&month=December
and so on
To
www.example.com/directory/2014/September
www.example.com/directory/2014/October
www.example.com/directory/2015/December
and so on
Hope you will definitely help with step by step process and how it work.
Thanks in advance
You can do that in the /directory/.htaccess file:
RewriteEngine on
RewriteRule ^(\d+)/(\w+)/?$ ?year=$1&month=$2 [L]
I have this url:
http://www.mysite.com/pronostici/data/2012/aprile-2012/7216-prono-02-04-2012
I have redirect to
http://www.mysite.com/pronostici/data_incontri/2012-04-02
How would I go about doing this in .htaccess?
Thanks
If I understand correctly your source URL, you can use the date at the end to build your target URL. So, something like this should work:
RewriteEngine On
RewriteRule pronostici/data/.*/\d+-prono-(\d+)-(\d+)-(\d+)$ http://www.mysite.com/pronostici/data_incontri/$3-$2-$1 [R=301,L]
I have a site with URL's like this:
http://website.com/browse/wedding-service-providers/bridal-wear-and-accessories/
I'd like to remove
/browse/wedding-service-providers
from the url each time so that the resulting URL is
http://website.com/bridal-wear-and-accessories/
Thanks for your help :)
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)-c-(.*)$ index\.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
Then url like
http://website.com/bridal-wear-and-accessories-c-3/
in this url 3 is the id of category
I am wanting to rewrite a url like:
http://my.project/mydomain.com/ANY_NUMBER_OF_CATEGORIES/designer/4/designer-name/page.html
to this:
http://my.projects/mydomain.com/ANY_NUMBER_OF_CATEGORIES/page.html?designer=4
I would like to use mod-rewrite to accomplish this.
Things to note:
Any number of categories can be between 'mydomain.com/' and '/designer'. For instance the url could be http://my.project/mydomain.com/designer/4/designer-name/page.html or it could be http://my.project/mydomain.com/tops/shirts/small/designer/4/designer-name/page.html
A query string may be provided in the original url that needs to be preserved in the rewritten url.
For example url provided could be: http://my.project/mydomain.com/designer/4/designer-name/page.html?color=red&type=shirt
Given the url above the resulting url would need to be: http://my.projects/mydomain.com/page.html?designer=4&color=red&type=shirt
The order of the query string does not matter. The 'designer=4' part could come before or after the rest of the query string.
I'm new to .htaccess and re-writes so any examples and or explanations would be greatly appreciated. Thank you very much.
Try this in your .htaccess file:
RewriteEngine on
RewriteRule ^(.+/)?(\d+)/[^/]+/([^/]+\.html)$ $1$3?designer=$2 [L,QSA]
I ended up having to create two separate RewriteRules:
RewriteRule ^designer/([^/]+)/.*/([^/]+)\.html $2.html?designer=$1 [NC,L,QSA]
RewriteRule (.*)/designer/([^/]+)/.*/([^/]+)\.html $1/$3.html?designer=$2 [NC,L,QSA]
Thanks to Gumbo for pointing out the [QSA] portion of the rewrite.