What is the problem with my .htaccess
This Works:
RewriteRule ^ressource\.n\.1/ /lesson [L,R=permanent]
But this, don't work. I don't know why.
RewriteRule ^index.php?id=51$ /file/?id=51 [L,R=permanent]
I just want when a visitor hit https://www.example.com/index.php?id=51 is going to https://www.example.com/file/?id=51
Thank you!
Related
I m trying to understand this redirecting but I cant solve this. I want to redirect forum/postPOSTID.html forum/posts/POSTID/
I tried this but i m doing something wrong.
Im reading and thinking it must be something like this:
RewriteRule ^post(.*)\.html$ /posts/$1/ [L,R=301,NC]
I tried this:
RewriteRule /post([0-9]+)\.html posts/$1/ [L,R=301,NC]
I tried this:
RewriteRule ^post([0-9]+)\.html$ /Forum/posts/$1/ [R=301,L]
Thanks for helping me out!
try
RewriteRule ^forum/post/([0-9]+)/$ forum/posts?POSTID=$1 [nc,qsa]
you forgot to put ? the sign of variable initiation in URL
I think there is an easy solutions to my problem, but I'm quite the noob when it comes to htaccess. So I'm asking for help.
RewriteRule ^home/([\w-]+)/?$ home.php?lang=$1 [NC,L,QSA]
This is my current code, and it works. But unfortunately, it only works on the page "home". And I want it to work on all pages of my URL. I've managed narrowing it down to this line:
RewriteRule ^/([\w-]+)/?$ ?lang=$1 [NC,L,QSA]
But it hasn't had any effect. So, could anyone help me with this?
You have to remove the leading slash from rule's pattern
RewriteRule ^([\w-]+)/?$ ?lang=$1 [NC,L,QSA]
It's so hard being a noob. I need someone to help me do this :-(
So basically, I need users to use this url:
en.mydomain.com <- very nice!
instead of using:
www.mydomain.com/index.php?lang=en
I know this is serious .htaccess stuff. Which I may never get my head around without any help. So, Thanks a lot.
You can place this rule as your very first rule in root .htaccess:
RewriteEngine On
RewriteCond %{QUERY_STRING} !(^|&)lang=en(&|$) [NC]
RewriteRule ^$ /index.php?lang=en [L,QSA]
I have the following entry in my .htaccess file:
RewriteRule ^blogs$ ?name=data&case=gview&group_id=31%1 [L]
What I do is, I redirect blogs to ?name=data&case=gview&group_id=31
Now what happens is, all my urls are now blogs?id=1 etc, but I need them to stay just ?id=1
How can I remove the blogs from rest of the urls?
This what I came up with, but it doesn't work:
RewriteRule ^blogs?(.*)$ /$1 [L]
EDIT I might be explaining it wrong. I need to change the actual url display of the links. Is that actually possible?
Not sure... but is that what you're looking for ?
RewriteRule ^/?$ /blogs [L,QSA]
What's wrong with just adding a R to your original rule?
RewriteRule ^blogs$ ?name=data&case=gview&group_id=31%1 [L,R=301]
Ok, the answer is pretty much: It can't be done. I just went over my code, added / before main urls and all is working as intended.
Thank you both for suggestions.
I'm trying to change all http://www.mysite.com/filename.php files to show as http://www.mysite.com/filename/ using mod_rewrite, but I seem to be doing something wrong.
Can anyone help out? I'm guessing it's something pretty simple for those that know. Thanks.
An awesome, simple, copy, paste style tutorial
http://www.workingwith.me.uk/articles/scripting/mod_rewrite
Try this:
RewriteEngine On
RewriteRule ^(.+)\.php$ $1/ [L,QSA]