# Nginx location regex for processing php extension less files

**URL:** <https://www.ruby-forum.com/t/nginx-location-regex-for-processing-php-extension-less-files/218170>\
**Category:** NGINX\
**Created:** [March 23, 2012, 2:58am UTC](https://www.ruby-forum.com/t/nginx-location-regex-for-processing-php-extension-less-files/218170 "2012-03-23T02:58:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [March 23, 2012, 2:58am UTC](https://www.ruby-forum.com/t/nginx-location-regex-for-processing-php-extension-less-files/218170/1 "2012-03-23T02:58:24Z")

</div>

Dear Nginx Forum Members,

I wish to implement the following which is working perfectly under  
Apache. This is being done for better SEO of the URLs.

Example URLS:

> **[Indian Astrology Horoscope Chart Prediction - Free Astrology, Indian...](https://www.astrogyan.com/enter/indian_astrology_horoscope_chart_prediction.html)**
>
> Indian Astrology Horoscope Chart Prediction. Instant Free Astrology, Indian Astrology, Free Horoscope Predictions. Complete Guide and information library about vedic indian astrology, hindu astrology, horoscope predictions, love astrology, match...

> **[Free Astrology Member Sign Up - Free Astrology, Indian Astrology, Free...](https://www.astrogyan.com/register/free_astrology_member_sign_up.html)**
>
> Free Astrology Member Sign Up. Instant Free Astrology, Indian Astrology, Free Horoscope Predictions. Complete Guide and information library about vedic indian astrology, hindu astrology, horoscope predictions, love astrology, match making prediction,...

> **[Indian Horoscope Astrology Chart Site Map - Free Astrology, Indian Astrology,...](https://www.astrogyan.com/sitemap/indian_horoscope_astrology_chart_site_map.html)**
>
> Indian Horoscope Astrology Chart Site Map. Instant Free Astrology, Indian Astrology, Free Horoscope Predictions. Complete Guide and information library about vedic indian astrology, hindu astrology, horoscope predictions, love astrology, match making...

> **[Know your Gemstone Blue Sapphire ~ Neelam - Free Astrology, Indian Astrology,...](https://www.astrogyan.com/know_your_gemstone/gID-7/sani_planet_saturn_gemstone_blue_sapphire_neelam.html)**
>
> Know your Gemstone Blue Sapphire ~ Neelam. Instant Free Astrology, Indian Astrology, Free Horoscope Predictions. Complete Guide and information library about vedic indian astrology, hindu astrology, horoscope predictions, love astrology, match making...

What I am exactly looking forward to is a location regex to catch all  
extension-less php scripts in the ROOT FOLDER ONLY for processing by  
php-fptm.

In all the above URLs “enter”, “register”, “sitemap”,  
“know\_your\_gemstone” are all PHP scripts and what follows them are dummy  
file names generated by PHP for SEO. Actually  
“indian\_astrology\_horoscope\_chart\_prediction.html” file name does not  
exist. In Apache, I use the following:

DefaultType application/x-httpd-php

In the last of the above URL, “gID-7” is used to pass a variable to the  
script to show appropriate content. While this URL is showing DYNAMIC  
content, the URL is so crafted that is looks like a STATIC URL which can  
be indexed by search engines easily. This variable parsing is done in  
PHP already and has nothing to do with Nginx.

I need to know how best can this be implemented under NGINX?

I have a VPS running ubuntu where I have installed nginx with php-fpm  
and for normal URL’s like index.htm / index.php the setup is working  
fine. I am not a pro in regex writing hence I am stuck up at this  
juncture. I searched online under many nginx blogs / forum but could not  
find the right solution.

I am using the latest development version of Nginx v1.1.17 with php  
v5.3.6.13. I have also compiled additional modules like more header,  
cache purge, memcache etc.

Any help on this will be most appreciated. Thanks in advance…

Regards  
Ganesh

Posted at Nginx Forum:

> **[nginx location regex for processing php extension less files](https://forum.nginx.org/read.php?2,224251,224251#msg-224251)**
>
> Dear Nginx Forum Members, I wish to implement the following which is working perfectly under Apache. This is being done for better SEO of the URLs. Example URLS: http://www.astrogyan.com/enter/indian\_astrology\_horoscope\_chart\_prediction.html...
