I have a url in my website
http://mywebsite.com/settings.php?action=invoice
I need to redirect it to
http://mywebsite.com/settings.php?action=invoice&view=all
try
RewriteEngine on
Rewritecond %{THE_REQUEST} \ /settings\.php\?action=invoice(\ |$)
rewriterule ^ /settings\.php?action=invoice&view=all [L,R]
Related
I need the url
from
localhost/project/category?c=electronics
to
localhost/project/category/electronics
I have tried
RewriteRule ^category/([^/\.]+)?$ /category.php?c=$1 [L]
RewriteRule ^category/+?$ /category.php?c=$1 [NC,L]
With your shown samples and attempts please try following htaccess rules. Please do clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteBase /
##External redirect to url change in browser.
RewriteCond %{THE_REQUEST} \s/(project/category)\.php\?c=(\S+)\s [NC]
RewriteRule ^ /%1/%2? [R=301,L]
##Internal rewrite to category.php in backend.
RewriteCond %{DOCUMENT_ROOT}/$1/$2.php -f
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/?$ %{DOCUMENT_ROOT}/$1/$2.php?c=$3 [QSA,L]
RewriteEngine on
RewriteBase /
RewriteRule ^project/category/([0-9a-z]+)$ /project/category?c=$1 [L]
Why is "project/" missing in your original try ?
You have to specify the full path.
You can try this simple rewriteRule wich should works.
Is it possible to redirect with htaccess, from
http://example.com/redirect.php?url=http%3A%2F%2Fanother.com%2Fsmiley.gif
to url parameter,
http://another.com/smiley.gif
Please advice.
You can use this :
RewriteEngine on
RewriteCond %{THE_REQUEST} /redirect\.php\?url=.+([^/]+\.gif)\s [NC]
RewriteRule ^ http://another.com/%1? [NE,L,R]
This will redirect /redirect.php?url=foobar/foobar.gif to http://another.com/foobar.gif .
Sorry but I just can not find the answer
I would like to change
http://www.domain.com/video.php?id=ALWAYS-A-NUMBER/ALWAYS-A-TITLE
to
http://www.domain.com/video/ALWAYS-A-NUMBER/ALWAYS-A-TITLE
So far I am using the code below but it also removes /ALWAYS-A-TITLE so I end up with "This-bit-is-ok/video/94015"
RewriteCond %{THE_REQUEST} \ /video.php\?id=([0-9]+)
RewriteRule ^ /video/%1? [L,R]
RewriteRule ^video/([0-9]+)$ /video.php?id=$1 [L]
Can anyone see why the end is missing please ?
Thanks
Try :
RewriteCond %{THE_REQUEST} \ /video.php\?id=([0-9]+)/([^\s]+) [NC]
RewriteRule ^ /video/%1/%2? [L,R]
RewriteRule ^video/([0-9]+)/([^/]+)/?$ /video.php?id=$1/$2 [L]
From /?act=view&id=NUMBER to URL
examples:
/?act=view&id=1 to http://google.com
/?act=view&id=2 to http://facebook.com/blabla
My code
Redirect 301 /?act=view&id=157 http://google.com
You can not manipulate query strings using a Redirect directive, you need to use mod-rewrite,
Try :
RewriteEngine on
#1)Redirect "?act=view&id=1" to "http://google.com/"#
RewriteCond %{THE_REQUEST} \?act=view&id=1 [NC]
RewriteRule ^ http://google.com/? [NC,L,R]
#2)Redirect "?act=view&id=2" to "http://facebook.com/"#
RewriteCond %{THE_REQUEST} \?act=view&id=2 [NC]
RewriteRule ^ http://facebook.com/? [NC,L,R]
I have downloaded the phpDolphon Social Networking Script. It is great, however, it does not have clean URLs. Does anybody know how to do it?
Here is an example of the index page:
mydomain.com/index.php?a=feed
and I want to change it to:
mydomain.com/
Here is an example of the profile page:
mydomain.com/index.php?a=profile&u=daniel
and I want to change it to:
mydomain.com/user/daniel
I have tried this but it doesn't seem to work. Any ideas?
RewriteEngine On
RewriteRule ^([A-Za-z0-9-+_%*?]+)/([A-Za-z0-9-+_%*?]+)/?$ index.php?a=$1&u=$2 [L]
How about:
RewriteEngine On
RewriteCond %{THE_REQUEST} \ /+index\.php\?a=feed
RewriteRule ^ /? [L,R=301]
RewriteCond %{THE_REQUEST} \ /+index\.php\?a=profile&u=([^&\ ]+)
RewriteRule ^ /user/%1? [L,R=301]
RewriteRule ^user/([^/]+)$ /index.php?a=profile&u=$1 [L,QSA]
RewriteRule ^$ /index.php?a=feed [L,QSA]
You'll need very specific rules:
# no 'feeds' in alias
RewriteRule ^$ index.php?a=feed (maybe it needs a /)
# 'user' in one, 'profile' in other
RewriteRule ^user/(\w\d+)$ index.php?a=profile&u=$1
etc