Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Some help with Rewrite rules in Apache/Nginx
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Some help with Rewrite rules in Apache/Nginx

CasterCaster Member
edited August 2016 in Help

Pls help.

I am trying to do this :

example.com/hello.php

It will actually forward/rewrite to :
example.com/index.php?id=hello.php

Looking to do it both on apache/nginx and using Cloudflare too [?].

Comments

  • BradBrad Member

    A single file or was that an example for many others?

  • @Brad said:
    A single file or was that an example for many others?

    that was example basically.

    example.com/<file_name>.<extension>

    gets :

    example.com/index.php?id=<file_name>.<extension>

  • Instead of trying to pass the request via query string, you could just pass it to index.php and handle it with PHP. Try this answer - http://stackoverflow.com/a/8458021

    For Nginx use try_files:

    try_files $uri $uri/ /index.php?$args;
    

    and handle the request with PHP.

  • @jesin said:
    Instead of trying to pass the request via query string, you could just pass it to index.php and handle it with PHP. Try this answer - http://stackoverflow.com/a/8458021

    For Nginx use try_files:

    try_files $uri $uri/ /index.php?$args;
    

    and handle the request with PHP.

    +1

    I believe this is the same for WordPress

  • @noaman said:

    @jesin said:
    Instead of trying to pass the request via query string, you could just pass it to index.php and handle it with PHP. Try this answer - http://stackoverflow.com/a/8458021

    For Nginx use try_files:

    try_files $uri $uri/ /index.php?$args;
    

    and handle the request with PHP.

    +1

    I believe this is the same for WordPress

    and about apache ?

  • @Caster said:

    @noaman said:

    @jesin said:
    Instead of trying to pass the request via query string, you could just pass it to index.php and handle it with PHP. Try this answer - http://stackoverflow.com/a/8458021

    For Nginx use try_files:

    try_files $uri $uri/ /index.php?$args;
    

    and handle the request with PHP.

    +1

    I believe this is the same for WordPress

    and about apache ?

    Check the StackOverflow link in my post.

Sign In or Register to comment.