Here is a dynamic url download file at my site:
Eg: mywebsite/shortUrl?download_token=xxxxxxx
Now I want to rewrite the url to:
Eg: mywebsite/shortUrl/download/xxxxxxx
how to rewrite?
Use this:
RewriteRule ^([-a-zA-Z0-9_]+)/download/([-a-zA-Z0-9_]+)$ $1?download_token=$2 [L]
Related
How to redirect from these URL using .htaccess.
I have a URL like this:
http://localhost/try1/1/php
When I click on contact.php page on the menu my URL change to
http://localhost/try1/1/contact.php
I want like this
http://localhost/try1/contact.php
My .htaccess file:
RewriteEngine On
RewriteRule ^([^/\.]+)/([^/\.]+)?$ video_about.php?id=$1&title=$2
Redirect dynamic URL for below example :
https://hostname/en/content-page
to
https://hostname/en/storename/content-page
content-page is the dynamic parameters Like-
https://hostname/en/grocery/vegetables?fetchFacets=true#facet:&productBeginIndex:0&facetLimit:&orderBy:&pageView:grid&minPrice:&maxPrice:&pageSize:&
to
https://hostname/en/storename/grocery/vegetables?fetchFacets=true#facet:&productBeginIndex:0&facetLimit:&orderBy:&pageView:grid&minPrice:&maxPrice:&pageSize:&
OR
http://hostname/en/electronics?fetchFacets=true#facet:&productBeginIndex:0&facetLimit:&orderBy:&pageView:grid&minPrice:&maxPrice:&pageSize:&
to
http://hostname/en/storename/electronics?fetchFacets=true#facet:&productBeginIndex:0&facetLimit:&orderBy:&pageView:grid&minPrice:&maxPrice:&pageSize:&
add /storename or /en/storename in dynamic URLs
You should be able to just put /en/ in your pattern and then substitute it with an appended storename. Add this to your .htaccess file:
RewriteEngine On
RewriteRule ^en/(.*)$ https://hostname.com/en/storename/$1 [R=301,L]
That will redirect as you've asked in your examples.
I want to rewrite my url with htaccess, when URL contains a certain string.
Example:
My url : example.com/information
When "information" is in my url, I want to rewrite to my information.php file.
Hope anyone can help me out.
Try this:
RewriteCond %{REQUEST_URI} !/information\.php$
RewriteRule information information.php [L]
This rule will rewrite any request that contains “information” in the URL path to information.php in the same directory.
Source
I have a URL like www.test.com?id=other-flavor&pid=hannycakes.
I did above URL like www.test.com/other-flavor$pid=hannycakes using .Htaccess
but I need www.test.com/other-flavor/hannycakes.
For this If I use / in my URL it can take as a folder.
How resolve my problem. How to put / in URL?
Try this:
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /?id=$1&pid=$2 [L]
How to rewrite URL like this
http://localhost/gestor_3.0/index.php?p=cadastros&t=operadoras
to
http://localhost/gestor_3.0/cadastros/operadoras
using htaccess and mod_rewrite.
To ReWrite your seo frindly url /cadastros/operadoras to the parsing php file
RewriteRule ^gestor_3.0/(.*)/(.*)/?$ /index.php?p=$1&t=$2 [L]