Zend frame work url problem? - php

i am getting url is http://localhost:8888/qmc/public/index.php/get-quote
but i want to http://localhost:8888/get-quote..
using zend..

You should configure your virtualhost and .htaccess file.
Read this post for details.

Related

PHP GET request but no ?=

I am trying to find out how websites like Imgur, MEGA and such are able to do this:
https://imgur.com/a/SbmNz (emphasis on SbmNz)
The SbmNz bit is dynamic between images or files and I guess it is a kind of $_GET. And I was just wondering how you can do this without the usual ?name=value way.
you can use any MVC or just write a htaccess rule for it , for instance, you can use laravel to pass variables along with url
for laravel refer URL Generation-Laravel5
to write .htaccess refer USING .HTACCESS REWRITE RULES
You can do with Apache rewriting module by changing .htaccess (Create .htaccess file in your folder)
For example if you have this snippet
RewriteRule ^play/([^/]*)$ player.php?id=$1 [L]
When user visits www.example.com/play/Trg4 in backend request is actually handled for www.example.com/player.php?id=Trg4
Then you can get the id with $_GET['id']. it means there is no change with php code. it is completely done with .htaccess
Make sure you enabled rewrite_module of your Apache server

I have changed my old website from asp.net to php and i need to redirect the pages using web.config

This is my current web.config file where i am trying to redirect the page of www.abadbuilders.com/projects/spice-town to www.abadbuilders.com/project. But what happens actually is that it doesn't redirect to the particular page instead it gets an 404 page not found error. Can anyone helps me on this issue.
Thanks
web.config is the configuration file for ASP.net it wont work with PHP.
If you are using an Apache server for your website then you can .htaccess file to set the URL redirection, else you can code in the PHP code itself using header('redirect', 'http://the.url/you/wish/');
For your reference
httpd URL Rewriting Guide
PHP: Header
For redirecting in CodeIgniter you can use Routes configuration.
You need to edit the file application/config/routes.php
You need to add after this line of code
$route['404_override'] = '';
Your rewrite code will be like this
$route['projects/(:any)'] = 'project';
I hope you have a controller Project that have functions to display projects.

hidequery string parameters from the url using url rewriting

In my php web site, I need to display my urn in a specific manner
I need to hide the query string parameters and just want to display the value in the URL
i.e.
mydomain.com/city.php?place='usa'&id=2
I need to display
my domain.com/city-2/usa
Is it possible?
Please help me. I am in a serious situation.
Thanks in advance
Yes, it is possible:
RewriteEngine On
RewriteBase /
RewriteRule ^city-(\d+)/(.*) city.php?place=$2&id=$1
You need to put it into the .htaccess placed in the web root of your site. To get it worked you need to have .htaccess parsing enabled and mod_rewrite apache module (assuming you have apache as a web server) enabled as well.
More in official documentation

php .htaccess mod_rewrite problem

hi friends there is some problem i need to convert
http://localhost/joomla/index.php?option=com_myblog
to
http://localhost/joomla/blog through .htaccess
any help?
If I'm not mistaken, Joomla by default ships with an htaccess.txt file that contains all the necessary script to do that. You just need to rename the file to .htaccess and enable the "friendly url" option in your sites settings.
http://www.noupe.com/php/10-mod_rewrite-rules-you-should-know.html ........ .htaccess should be in com_myblog folder other wise url mapping will not work like in noupe post it says URLs are Always Relative. problem solved thanks for anybody response

Reading the .htaccess DirectoryIndex and Rewrites with PHP

Is there an inbuilt way to read the active DirectoryIndex in .htaccess (or httpd.conf etc) with php?
Also, is there a way to determine which file the httpd will execute using PHP given a url if rewrites are being used?
Basically, given a URL, I want to use PHP to figure out which file the httpd would initially invoke.
Thank you.
The easist way I can think of is to use curl and make the real URL
request to see what page it gives you back.
That way there is no guessing, you will know for a fact what page it gives you back.
See apache_lookup_uri() function.

Categories