I want to give a link to my users like:
mydomain.com/654564
When a user opens the link, it must actually open url below:
mydomain.com/index.php?id=654564
I searched on google. All of results was about how to shorten a url (That is not what I need).
How can I do it with htaccess?
P.S: I'm using localhost with xampp on windows.
Related
I would like to make a redirect from one link to another. I mean:
I have a site:
www.mysite.com/index.php and I can do it as www.mysite.com/home, so in URL user can see home instead of ugly index.php. But... Here comes the problem... I need to make a redirect from www.mysite.com/index.php#myId to www.mysite.com/myId.
I tried a lot of things via the .htaccess file but nothing worked. Is there any way to do it?
i have a website and i want that whenever someone types in the domain it should take it to the dedicated path that i chose for it like when someone types www.gdrfa.info it should take the user to www.gdrfa.info/portal/pls/portal/ and if someone changes the url like www.gdrfa.info/portal/pls or changes anything after.info then too it should automatically redirect to my desired url can anyone tell me how can i do it i searched on web but could not find out what i wanted.
I tried
Redirect 301 "/old-page.html" "http://www.new.com/new-page.html"
I've got an odd redirect request, and I'm not sure if it is possible.
On the server we have a series of PHP files with a name similar to /title-of-the-page-####.php, where #### is an unique integer ID of the page.
I want to be able to redirect users from /#### to the full title of the page (as listed above). Is this possible from within an .htaccess file, and if so, how? (I would like to avoid listing all of the pages from within the .htaccess file)
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
I have just been asked to migrate a site from one server to another for a site that I did not build. They have a lot of links to pages that dont exist.
<a href="app/batteries">
This is not actually a directory in the site, but there is an app.php file in the root directory. I have gotten it to display the products by redirecting anything to the app/ directory to app.php?app=. The value of ?app= is dynamic, so any solution would need to be dynamic. I have simply used the redirect statement in the htaccess file to get it to the app.php page. Is there a way to get the url back to the pretty url after a redirect?
Any help would be awesome. Thanks in advance.
You should use ModRewrite instead, for matching a pretty url with regexps, and converting into the url using the app.php.
The rewrite is local to the server, so the visitor sees only pretty urls.