LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-28-2018, 11:55 AM   #16
Adirondacks
Member
 
Registered: Oct 2018
Posts: 98

Original Poster
Rep: Reputation: 0

Quote:
Originally Posted by hydrurga View Post
Perhaps due to the URL format's UNIX-origins the trailing slash used to imply a directory and the lack of it implied a file, but that is no longer the case. It can be either or neither these days, the URL often pointing at nothing in particular, just providing some server-side code with an indication about which resource it should serve up.

In the practical world, just decide on how you want your URLs to be canonically and stick to it for the sake of consistency. Browsers won't give a hoot anyway if there is a trailing slash or not.

As far as SEO is concerned: https://webmasters.googleblog.com/20...-to-slash.html
And this ties into my mod_rewrites, which exist to provide the user with a pretty URL, and then mapping it to whatever and wherever I want on my server.

So maybe I am getting too hung up on the *right* way to do things, and I need to be more focused on picking a convention and sticking to it?
 
Old 12-28-2018, 12:52 PM   #17
Adirondacks
Member
 
Registered: Oct 2018
Posts: 98

Original Poster
Rep: Reputation: 0
Here is an example of a mod_rewrite that I am better trying to understand...

As you can see, I have added comments at the top of the mod_rewrite to document how I *think* things work.

Code:
# ORIG URL:			http://www.mysite.com/products/index.php
# %{HTTP_HOST}:			http://www.mysite.com
# %{THE_REQUEST}:		GET /products/index.php HTTP/1.1
# %{REQUEST_URI}:		/products/index.php
# .* in ^.*/index.php:		/products
# (.*) in ^(.*)index.php:	/products/
# $1:				/products/
# NEW URL:			http://www.mysite.com/products/

RewriteCond %{REQUEST_URI} ^.*/index\.php
RewrieRule ^(.*)index.php$ $1 [R=301,L]

If someone could please verify that my comments are correct, that would be appreciated!

Thanks!
 
Old 12-28-2018, 12:56 PM   #18
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 9,395

Rep: Reputation: 4172Reputation: 4172Reputation: 4172Reputation: 4172Reputation: 4172Reputation: 4172Reputation: 4172Reputation: 4172Reputation: 4172Reputation: 4172Reputation: 4172
The technical difference (usually) is that one returns a 200 response code, and one returns a redirect.
 
Old 12-28-2018, 04:51 PM   #19
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,630

Rep: Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808
Quote:
Originally Posted by Adirondacks View Post
Here is an example of a mod_rewrite that I am better trying to understand...

As you can see, I have added comments at the top of the mod_rewrite to document how I *think* things work.

Code:
# ORIG URL:			http://www.mysite.com/products/index.php
# %{HTTP_HOST}:			http://www.mysite.com
# %{THE_REQUEST}:		GET /products/index.php HTTP/1.1
# %{REQUEST_URI}:		/products/index.php
# .* in ^.*/index.php:		/products
# (.*) in ^(.*)index.php:	/products/
# $1:				/products/
# NEW URL:			http://www.mysite.com/products/

RewriteCond %{REQUEST_URI} ^.*/index\.php
RewrieRule ^(.*)index.php$ $1 [R=301,L]

If someone could please verify that my comments are correct, that would be appreciated!

Thanks!
Yup your comments are correct.
 
1 members found this post helpful.
Old 12-29-2018, 06:09 PM   #20
Adirondacks
Member
 
Registered: Oct 2018
Posts: 98

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
Yup your comments are correct.
Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Replacing "slashes" with back slashes - escape character problem kushalkoolwal Programming 2 01-08-2011 02:16 AM
regular expression that matches forward slashes? zero79 Linux - Software 4 12-24-2005 12:43 PM
What do two forward slashes in a url mean? (not the inital 2) johnMG Linux - Networking 2 06-28-2005 11:27 AM
bash and double slashes MD3 Linux - Software 0 02-18-2005 04:13 PM
Forward slashes in filenames. Convert from 2f to Colon chrisk5527 Linux - General 3 03-26-2004 04:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration