S
S
sos1mple2017-08-02 23:20:06
PHP
sos1mple, 2017-08-02 23:20:06

How to make a redirect to styles in another folder?

There is a project structure like this:

app
public
index.php

I need all requests for style files, js scripts, etc. went to public and everything else to index.php
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Shapoval, 2017-08-02
@sos1mple

Register in the root .htaccess

RewriteEngine On
RewriteCond $1 !^(index\.php|public|robots\.txt|sitemap\.xml)
RewriteRule ^(.*)$ /index.php/$1 [L]

A direct request to something can only be received from the public folder, throw js , css and other statics there.
sitemap.xml and robots.txt can stay at the root.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question