I need help to rewrite an url parameter with htacces.
The url which comes from my affiliate partners looks like:
http://example.com/#colo=123abcABC
And I need ist like this:
http://example.com/#sv=123abcABC
I tried this htaccess entry:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^colo=(.*)$
RewriteRule ^(.*)$ $1?sv=%2 [R=301,L]
But this is not working. Can anybody help me please?
Thanks, Michael
Related
I'm trying to use htaccess to do a url rewrite.
I would like the people to access the site in the browser using this:
http://exmaple.com/ladada
But the files are inside a subdomain:
http://ladada.exmaple.com
Would that be possible? People will access the site using the first link but in the backend it's being rewritten to the second link? Thank you so much!
mod_rewrite doc should help you.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ladada\.example\.com [NC]
RewriteRule (.*) http://example.com/ladada/$1 [L,R=301]
I want a solution to redirect http://www.myexample.com/page.php?page_id=35 to http://www.myexample.com/about-us.Please help as have been googling but all in vain.
EDITED. You can try something like this:
RewriteCond %{QUERY_STRING} ^page_id=([0-9]*)$
RewriteRule ^index.php$ /about-us? [R,L]
This will check, if index.php has parameter ?page_id,
if has, will redirected
I have lot or articles with this URL format:
mydomain/art/details.php?articleid=24463&parentid=1&catid=166
the above is an example.
And i want that redirect these kind of URL to :
mydomain/art/24463.html
Please let me know that how can i do it with .htaccess?
Thanks in advance
Instead of mydomain/art/24463.html you should choose something like mydomain/art-166/1-24463.html.
This way, you'll include also parentid and catid which are dynamic parameters (and so, needed for rewriting).
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/art/details\.php\?articleid=(\d+)&parentid=(\d+)&catid=(\d+)\s [NC]
RewriteRule ^ /art-%3/%2-%1.html? [R=301,L]
RewriteRule ^art-(\d+)/(\d+)-(\d+)\.html$ /art/details.php?articleid=$3&parentid=$2&catid=$1 [L]
Try this in htaccess tester
RewriteEngine on
RewriteRule ^art/(\d+).html$ art/details.php?articleid=$1&parentid=1&catid=166 [nc]
I want to redirect image request if current url contain specific string, for example /id/
so far i tried the following syntax on htaccess.
RewriteCond %{REQUEST_URI} /id
RewriteRule (.*)/image1.png$ $1/image1-id.png
i am not good with htaccess, please point me.
Try this
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/id/(.*)$
rewriterule ^image1.png(.*)$ image1-id.png$1 [r=301,nc]
I have url pattern like this.
site.com/page-name?variable-name=variable value
I want this to be site.com/variable - value
I' am not good in rewrite api. Please guide me through .htaccess.
Try this
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)=(.*)
RewriteRule ^(.*) /%1-%2? [R,L]