I'm building w Wordpress site and I have to pass a get parameter in the URL string, my issue is that after trying all the usual rewrites I have found on here (I have no idea about rewrites) none seem to work, and yes I have the mod_rewrite enabled. The URL is like this www.mysite.com/staff/?staffid=12
How can I rewrote that to
www.mysite.com/staff/staffid/12/
Permalinks are already turned on etc also.
Thanks in advance.
Related
I need to redirect
from
/showthread.php?tid=6
to
/viewtopic.php?t=6
using htaccess. We moved from MyBB to PhpBB and would like to safe links leading to our site.
The domain remains the same. All my attempts failed.
Can someone help?
^showthread.php?tid=(\d+)$ viewtopic.php?t=$1
This should do the trick with htaccess redirect parameter :)
Google crawler mistakenly adds a wrong string of my domain to the end of every link in my site :(
For example: www.mydomain.com/folder/www.mydmain.com (as you can see the domain that adds to end of the link is not my original domain name).
it happens in many pages and what I thought to do is to create 301 redirect with
the correct URL removing the extra www.mydmain.com in the end of the URL.
I've tried several solutions that were offered here but with no success.
How can I remove the extra string at the end of the url in .htaccess?
Thanks!
Lior
You can use the following redirect in htaccess to remove the trailing part (www.domain.com) from your urls.
RedirectMatch 301 ^/(.+)/www\.domain\.com$ /$1/
I would like to add a line to my htaccess to change this url:
RewriteEngine on
do this is the url
http://site/Calendar/viewevent?eventid=9223
into something like this :
http://site/Calendar/viewevent/Title-of-event
its php and joomla and I am a php developer, please dont advise me to use a component or module to handle redirects, I am trying to achieve this using .htaccess ONLY :) thank you in advance!!
Your 'pretty' url contains information that is not in the 'working' url. Besides that, the 'working' url also contains information that is not in the pretty url. You need database access to translate the event id to a seo-title, and the seo-title back to an event id. In other words: It is impossible to do this with .htaccess only, unless you change 'viewevent' to accept an event by seo-title, instead of eventid.
Mod_dbd can possible be used, but only in the server config file, not .htaccess.
As Sumurai8 says htaccess cant transform url like you want automatically.
But you can use Redirect 301 (or its variation) for one url to another.
for your example:
Redirect 301 /Calendar/viewevent?eventid=9223 /Calendar/viewevent/Title-of-event
more information here
hope you can help me. i need a redirect from
/abc_company_detail.php?id=4 to detail/4/
So when I call the URL http://mydomain.com/abc_company_detail.php?id=4 then I got this pretty URL http://mydomain.com/detail/4/
You can use some PHP framework, and it will managed the URL for you. If you want to do it manually you have to configure .htacess file.
Try this link. .htaccess friendly URl
This kind of question had been asked before.
I am struggling with an url/parameter issue.
The main index.php page of my website was previously used for e.g.
www.domain.com/index.php?site=3&word=21 and
www.domain.com/index.php?site=3
But now I have changed those things, but in Google the URLs are still listed. So what I need is to redirect all the type of pages above to the main page/domain www.domain.com.
I believe .htaccess redirect is the right thing to use then, is that correct?
What type of code do I need to redirect those to main domain. Just the url's with parameters after index.php? etc. not other directories e.g. www.domain.com/sunshine/
Would be great if someone could help me with this. I believe it is actually a quick fix, but I have failed to get the code correct.
Thanks.
You can add this to an .htaccess in your site root:
RedirectMatch permanent ^/index.php* http://www.domain.com/
But, be careful if your new index page is also named index.php because you might run into a redirect loop.