I had previously posted this question how to create friendly URLs without losing css
and js
e imágenes
.
In localhost
works perfectly without any problem. The problem arose when uploading to the server hostgator ( main domain linked to the server ) the URLs friendly does not work www.example.com/online/video/hd/free/
sends me directly to 404 error page
Perform tests with other friendly urls from another file .htaccess
to see if the server was accepting or not accepting the URLs friendly but it worked perfectly without any problem.
The problem is in this file .htaccess
or rather in the path RewriteBase /project/
In localhost the project is: project - > localhost/project/index.php
He mentioned precisely that the error is in the route
RewriteBase /project/
because inlocalhost
if the name of the project does not exist or if it exists and the name or other name that is not: project the same error occurs on the server, the same error I'm having.
# Activamos mod_rewrite
RewriteEngine on
# Seleccionamos el directorio base para el RewriteRule
RewriteBase /project/
# Aquí nos evitamos comprobar que sea un archivo (agrego comprobación
# para detectar también directorio) en cada conjunto de reglas
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ $1 [QSA,L]
# Obtenemos todo lo que vaya tras "assets/" y subdirectorios previstos
RewriteCond %{REQUEST_URI} assets/(css|fonts|js|img)/(.+)$
# Entonces (si se cumplen todas las condiciones) redirigimos (R)
# y dejamos de evaluar el resto de reglas (L)
RewriteRule ^(.*)$ assets/%1/%2 [L,R]
# Tu/s regla/s
RewriteRule ^online-video-en-hd-gratis/?$ video.php [L,NC,QSA]
RewriteRule ^online/video/hd/free/?$ online.php [L,NC,QSA]
I have tried this way: RewriteBase /www.example.com/
and in this way RewriteBase /public_html/
but no success does not work.
NOTE: The example domain:
www.example.com
is direct in public_html without any other folder ie it does not have a folder like in the other additional domains that are the same in public_html but in a folder specifies a folder:OTRAPAGINA.COM
public_html (as you can see there exists the index.php equally the direct online.php in the folder public_html because it is linked to the main domain to the configured domain with the server.)
The Server is linux / apache perform tests with this .htaccess
file and it worked fine by visiting the following URLs www.example.com/online/video/hd/free/
RewriteEngine on
RewriteRule ^online/video/hd/free/$ online.php [L,NC,QSA]
The specific URLs is: www.example.com/online.php
But in the .htaccess
file I'm having problems visiting the same URL www.example.com/online/video/hd/free/
redirects me to 404 error page.
Also, then I plan to use a second structure:
public_html -> EXAMPLE.COM(<- carpeta) -> online.php
If it were not the main domain, if not an additional domain and it was like this, how should I modify the .htaccess
?