I need help in adding strings to the url:
Ex : mydomain.com/categoryname
to : mydomain.com/category-list/categoryname
I try: RewriteRule ^(.*)/.{0}$ category-list/$1 [R=301], but this not working.
My English is not good,
Hope everyone sympathize,
Thanks all.
Related
I'm actually using this rule:
RewriteRule ^([a-z]+)/([A-Za-z0-9%])/?$ index.php?get1=$1&get2=$2 [NC,L]
In order to convert this hypothetical url:
.com/index.php?get1=portfolio&get2=jY1eF7FGR7k0zFYfdioRJOzzWJpkYXeTbmqUtamRV5U%3D
in this one:
.com/portfolio/jY1eF7FGR7k0zFYfdioRJOzzWJpkYXeTbmqUtamRV5U%3D
(the get2 parameter is crypted and url encoded)
The problem is that when I insert this long parameter in get2, it give me a 404 not found page when I try to visit the desidered url, but if I try to insert random words (without special character or number) it works and give me the page. Anyone that know the reason?
Thanks.
Try with below,
RewriteRule ^([a-z]+)/([A-Za-z0-9\%]+)/?$ index.php?get1=$1&get2=$2 [NC,L,B]
I am running a website on apache and the problem i am facing is below .
The actual link looks like this :
www.domain.com/my-account/profile-view.php?id=1018428
where id is the user id of the user .
Now my .htaccess looks like this :
RewriteRule ^my-account/([0-9]+)/([a-zA-Z0-9-]+)$ my-account/profile-view.php?id=$1
Basically i want the URL to be rewritten like this :
www.domain.com/my-account/15/Craig
I've done different permutations to the above htaccess line and none seem to work . Any help would be appreciated .
P.S : My htaccess is working fine and is being read by the server .
maybe this will help you
RewriteRule ^my-account/([0-9]+)/([a-zA-Z0-9-]+)/$ my-account/profile-view.php?id=$1&name=$2 [nc,l]
You need two variables since you have two regex in your url:
- ([0-9]+) for the id
- ([a-zA-Z0-9-]+) for the username
The nc flag means non-case-sensitive (so Craig will also match craig)
the l flag means "last", when rule is validated, stop processing the htaccess rules below that point
searched on stackoverflow a bit, but nothing helpfull.
I want to do the following via htaccess.
I have this url:
site.com/location/usa/ca/los-angeles
and I want this:
site.com/location/ca/los-angeles
Basicly I want to remove the abbreviation of the country. Keep in mind, I have more then one country.
Any ideas?
To change all link like /location/1/2/3 to /location/2/3.
Use in your : /location/.htaccess:
RewriteEngine on
RewriteRule ^[^/]+/([^/]+/[^/]+)/?$ $1 [R=301,L]
I am new in htaccess rules. I have tried to search about my question but couldn't get the answer.
I have got a url like this mysite.it/test/libro/la-missione-cristiana/1959 and I would like to rewrite to mysite.it/test/index.php?page=libro&id=1959
I have the following htaccess file in my root folder and I have added the following line:
RewriteRule ^test/libro/([^/.]+)/([^/.]+) test/index.php?page=libro&id=$2 [QSA,L]
but It doesn't work.
I would really appreciate if someone could explain me the cause.
Thank you,
your match all but slash group '([^/.]+)' appears to group all non-slash and non-any-character, thus it will not match anything as the . matches any, and the plus require at least one match.
try remove the dots
RewriteRule ^test/libro/([^/]+)/([^/]+) test/index.php?page=libro&id=$2 [QSA,L]
should work for you.
How can I redirect someone who types http://domain.com/+abc (this should only apply to alphanumeric characters with a preceding "+" sign) into the address bar to http://domain.com/abc without the preceding "+"?
Would I have to do this via .htaccess? And if so, how? Would it also require some REGEX?
I'd appreciate any help on this! Thank you :)
Yes, you can do it with .htaccess and it will require regex. Add these lines into yours .htaccess file:
RewriteEngine On
RewriteRule ^\+(.*) $1
This should work.