• Welcome to Simple Machines Community Forum. Please login or sign up.
January 26, 2022, 05:52:10 PM

News:

Join the Facebook Fan Page.


SEF URL's for Apache?

Started by MobileCS, October 11, 2021, 09:46:52 PM

Previous topic - Next topic

MobileCS

Where can I find the code that creates all the SEF URL's for Apache?

I'd like to create my own Nginx rewrite rules for them. I've been going through my forum and access logs, and this is what I have found so far.

Is this all of them? Which ones am I missing?

/forum/index.php/board,4.0.html (Board)
/forum/index.php/board,4.4860.html (Board pagination)

/forum/index.php/topic,48634.0.html (Topic)
/forum/index.php/topic,48634.1280.html (Topic pagination)

/forum/index.php/topic,51097.msg678233.html#msg678233 (Message in topic)
/forum/index.php/topic,51097.msg678233/topicseen.html#678233 ("Recent Posts" links)

/forum/index.php/topic,3060.0/prev_next,prev.html (Prev/Next for topic)

Kindred

Those are basically useless now. They were designed for back in the day when search engines could not deal with variables in the url.

If you want to see a different way to do it, look at the pretty urls mod
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

MobileCS

I'm not able to switch to anything else as I've been using SEF since 2003.

If I did, my forum SEO would tank pretty hard.

Kindred

well....  it would for a moment.  However, SEO recovers pretty quickly, as long as the content is still there.


but no, I don't think that's all of the urls -- because there are things like profiles and other items which would also have been re-written.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

MobileCS

Could you tell me which files creates these .html links?

I tried using grep and searching for '\.html' but it only shows a couple results - which are only responsible for inserting the SID in to the URL - not creating them.

Kindred

Probably either subs.php or load.pho
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

wintstar

Quote from: MobileCS on October 13, 2021, 04:09:22 PMCould you tell me which files creates these .html links?

I tried using grep and searching for '\.html' but it only shows a couple results - which are only responsible for inserting the SID in to the URL - not creating them.

smf 2.0.18
Sources/QueryString.php function ob_sessrewrite, sid_insert__preg_callback, pathinfo_insert__preg_callback
Sources/Subs.php function fix_redirect_sid__preg_callback, fix_redirect_path__preg_callback

smf 2.1 RC4
Sources/QueryString.php function ob_sessrewrite
Sources/Subs.php function ob_sessrewrite
Regards Stephan

,,In order for the possible to come into being, the impossible must be attempted again and again."
Hermann Hesse (1877-1962)

My HomepageMy Board - My Atelier

MobileCS

I just noticed that no Nginx rewrites are necessary to make the SEF option to work for Nginx + PHP-FPM.

All I needed to do was modify one line in each Subs.php and QueryString.php files and force enable the SEF options.

if (true || !empty($modSettings['queryless_urls']) ...
I commented out my rewrites for SMF in Nginx, restarted the Nginx and PHP-FPM servers and everything just works.

In my testing so far, all the expected URL's are in "SEF" format and clicking them navigates to all the right locations. I also tested creating new topics, replying to posts, etc with no issues.

I've confirmed Nginx was speaking with PHP-FPM (and not Apache) by using "phpinfo();".

The only thing I have in Nginx is to pass all "/forum/index.php" requests to PHP-FPM.

location ~* /forum/index\.php {
      include         /usr/local/etc/nginx/php-fpm.conf;
      fastcgi_pass    unix:/var/run/php-fpm.sock;
}

So with that said, why is does this option show "Apache/Lighttpd only"?

wintstar

Quote from: wintstar on October 13, 2021, 08:41:57 PM
Quote from: MobileCS on October 13, 2021, 04:09:22 PMCould you tell me which files creates these .html links?

I tried using grep and searching for '\.html' but it only shows a couple results - which are only responsible for inserting the SID in to the URL - not creating them.

smf 2.0.18
Sources/QueryString.php function ob_sessrewrite, sid_insert__preg_callback, pathinfo_insert__preg_callback
Sources/Subs.php function fix_redirect_sid__preg_callback, fix_redirect_path__preg_callback

smf 2.1 RC4
Sources/QueryString.php function ob_sessrewrite
Sources/Subs.php function ob_sessrewrite

Sorry for typing error
smf 2.1 RC4
Sources/Subs.php function redirectexit
Regards Stephan

,,In order for the possible to come into being, the impossible must be attempted again and again."
Hermann Hesse (1877-1962)

My HomepageMy Board - My Atelier

Advertisement: