It is possible to use SEO friendly url to download files and in php includes?

I got some questions about SEO friendly url's

1.-I was wondering if it is possible to use a SEO friendly url's to download a file, I mean usually to download a file most of us use url's like "", but I would like to know if it is posible to add a "rewriterule" in my .htaccess to use a SEO friendly url like "" to download the pdf file localted in the folder "pdf" and hide the real path of the file.

2.- ¿It is possible to use SEO url's with php includes?
In my code i got code like <?php include ("assets/principal.php"); ?>, but I wanna know if it is possible to add a "rewriterule" in my .htaccess to use a SEO friendly url to use includes like <?php include (""); ?>
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dr. KlahnPrincipal Software EngineerCommented:
What is meant / implied by the term "SEO friendly" links?  I have not heard of such a thing.

Search engines don't care what the URL in a link looks like, as long as it leads to real, useful content.
altariamx2003Author Commented:
Hi Mr. Klahn when I mean "friendly links" (friendly url) its something like this

in my .htaccess I add this rule
RewriteRule ^industrias/([a-zA-Z0-9-/?=&]*)$ /oculto/industria.php?rID=$1 [L]

This allow me to use links like this: instead of

Sorry my english sucks i mean "friendly url"
Dr. KlahnPrincipal Software EngineerCommented:
The search engine doesn't care what the URL looks like.  All it wants to see is content where the URL points at.  The URL can be the most unreadable, scribbled up, obfuscated with hex characters thing you can imagine ... search engines do not care a bit.
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

altariamx2003Author Commented:
Im gonna try to be more clear

Again sorry for my english

Question No. 1
As you know when we wanna add a downloadable file in a website we usually add a url like "http://www.myserver/pdf/myfile.pdf" as an example

I was wondering if it is exists a way to add a "rewriterule" in my .htaccess like RewriteRule ^mydownloads/([a-zA-Z0-9-/?=&]*)$ /hidden/mydownloads.php?rID=$1 [L] or something like that, that let me use url's like http://www.myserver/mydownloads/myfile to download some file in a hidden folder. The idea is to keep my real download folder in a secure and hide location path.
Question No. 2.
Currently to hide the real location of my JS files is Im using a "rewriterule" in my htaccess like: RewriteRule ^controls/(.*)$ /hiddenassets/controls/$1 [NC,L]. This rule allow me to add lines like:
            <script src="controls/folder1/jquery.appear.min.js"></script>
            <script src="controls/folder1/jquery.easing/jquery.easing.min.js"></script>
            <script src="controls/folder1/common/common.js"></script>

That rule allow me to keep all my JS files in a secure and hidden location.

I wanna know if there is a way to add a "rewriterule" in my .htaccess like RewriteRule ^myassets/([a-zA-Z0-9-/?=&]*)$ /hidden/myassets.php?rID=$1 [L] or something like that, that let me use "friendly url´s" in a php include's like  <?php include ("myassets/mycontrols"); ?>.

The main idea is to use the friendly url inside the php "include" to use a master php file to call my JS files (located in secure and hidden path).

Or if this is not possible i would like to know how to create a master JS file where i can Import all my JS files that my website will use

Best regards
Julian HansenCommented:
1. Yes - you can link any url to a download - you can link to a PDF. For example you could have the following rule in your .htaccess

RewriteEngine on
RewriteBase /
RewriteRule ^something$ something.pdf [L,NC,QSA]

Open in new window

Alternatively you can route the request to a script that uses the readfile() and header() commands to send back the file

2. I cannot think of a single valid reason for why you would want to do this. Your script will never be seen by a spider - only what it outputs so why would you want to do this?
altariamx2003Author Commented:
thx for answer Julian

1.- Thx for the advice, i made a rule and it works like a charm.

2.- Just to improve my code.
For example with the CSS files using the rewriterule RewriteRule ^controls/(.*)$ /hidden/$1 [NC,L] I use a master CSS file where I call all the css that im using in the current page

In the page i got: <link rel="stylesheet" href="/controls/principal.css">, and inside the file i got something like this:
@charset "utf-8";
/* CSS Document */
@import url(/controls/css/global.css);
@import url(/controls/css/webfont_global.css);

I like to handle my css like that because allow me to do a better code (I hope so).

I was wondering If it is possible to do the same for my JS files
Julian HansenCommented:
<?php include ("assets/principal.php"); ?>,
Is not the same as an import in CSS - the former happens on the server, while the latter in the browser.

I still can't think of why you would want to use an SEO friendly URL on a PHP include?

I was wondering If it is possible to do the same for my JS files
This is now a different question.

The idea is to reduce the number of roundtrips to the server. Modern web apps combine CSS into a single file - same with JS - and with JS they also do something called Tree Shaking to remove code that is not used.

If you are not using a build environment that uses webpack or similar then you can do this manually - in your JS files you would create a release JS file that comprises minified versions of your JS scripts in one file.

This is why there has been a move towards build environments that allow you to structure your code logically in the source but packs the files into optimized resources for distribution.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
altariamx2003Author Commented:
thx for your answer Julian, im gonna check about "tree shaking"

Thx a lot bro
altariamx2003Author Commented:
thx to julian
Julian HansenCommented:
You are welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Search Engine Optimization (SEO)

From novice to tech pro — start learning today.