rewrite timthumb to actual url - image

I'm stuck.
I don't want to use timthumb anymore and removed it. I get some requests from Facebook that I want to redirect/rewrite with .htaccess, but everything I tried didn't work out.
This is the request url
example.com/wp-content/themes/Example/timthumb.php?src=http%3A%2F%2Fexample.com%2Fwp-content%2Fuploads%2Fimage_level1.jpg&h=350&w=960&zc=1
and I want them to go straight to
example.com/wp-content/uploads/image_level1.jpg
Any help is highly appreciated.

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^wp-content/themes/Example/timthumb.php?src=http%3A%2F%2Fexample.com%2Fwp-content%2Fuploads%2F([a-zA-Z0-9]+).jpg&h=350&w=960&zc=1$ wp-content/uploads/$1.jpg
This should do the trick

I have ended up using this one
RewriteCond %{QUERY_STRING} ^src=http%3A%2F%2Fexample.com%2Fwp-content%2Fuploads%2F(.*)&h=350&w=960&zc=1$ [NC]
RewriteRule ^(.*)$ http://example.com/wp-content/uploads/%1? [NC, L]

Related

Redirection from domian.com to www.domain.com?

Can anyone help in learning how to redirect domian.com to www.domain.com (I use Magento) step by step?
Preferably give some screenshots how to do all that.
Also, please let me know how to redirect permanently the category to product page in Magento.
I tried many times doing it on my own seeing some instructions in Google, but really did not help. So, I would like somebody specifically helping me in that.
Hello add below code into your .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com$1 [R=301,L]
</IfModule>
Hope this help you

domain.com/username mod rewrite in codeigniter

I'm new to mode rewrite thing. Started off with codeigniter a couple of days back and trying to get a hand at it. I'm developing a website which needs domain.com/USERNAME for better SEO results. But I'm unable to figure out as to what mod rewrite I should write to achieve this. I already have removed the index.php entry in config and my base url is http://127.0.0.1/myproject/. (I'm using XAMPP)
So I have to search for username in this format
http://127.0.0.1/myproject/USERNAME
and return the corresponding page. My current mod rewrite file goes as follows :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Any suggestions?
Thank you for your help :-)
http://daparky.com/codeigniter-vanity-username-personalised-urls/
this should solve your problem.

mod_rewrite redirect one domain to another URL

I have the freemagickey.com and the gogomagickey.com domains both pointing to the same Apache server. Any request to the gogomagickey.com domain should currently redirect to http://www.indiegogo.com/magickey-perfect-password-management/.
I have been reading the mod_rewrite docs and looking at what seems to be similar questions on SO and hacking away at my .htaccess with no joy. Either nothing is redirected or both domains are redirected.
Is it possible to do what need with mod_rewrite in .htaccess?
Yes, it's possible, and I believe this should do the trick for you:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} gogomagickey\.com$ [NC]
RewriteRule ^(.*)$ http://www.indiegogo.com/magickey-perfect-password-management/ [L,R=301]
</IfModule>

speicif HTTP url to HTTPS url (only one url)

I was searching on web for like 4 hours and tryeda almoast everything, but nothing worked.
All i want to do is force redirecting for norma url to https url, using .htaccess, example:
I want that when person visit:
- http://www.mydomain.com/index.php?option=com_dms&task=checkout&Itemid=816
See:
- https://www.mydomain.com/index.php?option=com_dms&task=checkout&Itemid=816
that's pretty much all, I hope this is simple enough.
Thanks for answers in advance!
To do it only for your URL, this should work :
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^http://www\.mydomain\.com/index\.php?option=com_dms&task=checkout&Itemid=816$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Replace the URL by .* for all traffic.

How to use mod_rewrite with anchors but no [R=301]

I have a website build on jQuery scrollTo plugin. Each page is accessible via anchor's, ie.
www.domain.com/#page-one
and deeper
www.domain.com/#page-one--some-content.
I'd like to create rule with mod_rewrite so address like
www.domain.com/page-one
or
www.domain.com/page-one/some-content
point to the above one. Its quite easy with [R=301] flag but I need my "clean" address /page-one/some-content to stay in address bar not changing to #page-one--some-content.
Why I need to change them? Because for some reasons I need to use alternative site for MSIE and Opera, kind of regular one with reloading every page. I need the same links for both sites which is obvious, I think.
I spent lots of time digging & reading about anchors in URL's and stuff, but I haven't reach my goal. If any one can help me, I'll appreciate!
Thanks, Kuba.
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule (.*) /index.php#$1 [NE]
This works excellent for me.

Resources