Generally a url that appears such as this: http://world wide

will open product.php and serve the /12/ as request parameters, which in turn my PHP script can process to drag the best product info. However, if I migrated this complete site, after developing it, to an alternative server, I recieve a 404 error, because on that server it isn't defaulting towards the mother directory/file just in case of the lack of asked for sites.

I vaguely remember learning this generally is a common apache function however i can't appear to recall how to put it together or how you can manipulate it.. if there's an .htaccess method to do this that might be great.

What you are mentioning to is mod_rewrite. The state paperwork for this are here:

You'd configure it in both your VHost definition (suggested) or perhaps in an .htaccess file.

Presuming you want to map all demands to some resource that Apache cannot serve (for example files that do not exist) to items.php you should use the next:

RewriteEngine On

RewriteCond % -s [OR]

RewriteCond % -l [OR]

RewriteCond % -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^(.*)$ /items.php?request=$1 [NC,L]

After that you can use $_GET['request'] to find the path asked for and take over from there, based on what for you to do. I'd normally recommend letting mod_rewrite handle parsing the request and passing the correct characteristics for your PHP, but when you are unfamiliar with mod_rewrite it's most likely simpler to get it done inside your PHP.

you should use mod rewrite engine to map this to

http://world wide

Mod rewrite particulars:


Options +FollowSymlinks

RewriteEngine on

RewriteRule ^files/([^/]+)/(.+) files.php?application=$1&file=$2 [NC]

this rewrite rule will map any request that contains files/firstrPart/secondpart towards the script files.php

everything between the foremost and second slash after files is going to be passed as parameter application and also the relaxation as file

Basicly you define a regex with a few subpaterns and condition which script should certainly be known as.

You certified nursing assistant make reference to the subpatterns with $n where n may be the 1 based index from the pattern.

Have some fun.

NOTE this can be a extreme simplification of mod rewrite. Please do your homework prior to using it as this might go terribly wrong...

The directive you are searching for is "AcceptPathInfo on". mod_discussions MultiViews feature would also provide you with the use of excluding the ".php" that is another common one people abuse mod_rewrite to complete.