0
I have a directory inside my root folder called "mydir" where there are several files, currently I access these files so:
http://mysite.com/mydir/myarchive.html
My question is I have how to configure . htaccess so that I can access (show to the user) these files so:
http://mysite.com/myarchive.html
But I don’t want to redirect all the files, only the ". html".
I’m trying on my . htaccess, but I get a 404:
RewriteRule "^/(.+)$" "/mydir/$1"
Where " /(.+)$" is the regular expression, which I read in the documentation of apache that is to say:
^ = anchor to start expression.
/ = project root.
(.) = means any character.
+ = repeat "." once or more.
/mydir/ = directory which I want to replace.
$1 = variable referring regular expression in parentheses.
$ = anchor to end the expression.
And yet, when I try to access http://mysite.com/myarchive.html, I get a 404 error from page not found. Note that I haven’t even taken only html, but I imagine it would be something like " /(..html)$" where you need to escape . with a backslash.
https://answall.com/questions/89342/rewrite-como-redirecionar-tudo-sem-index-php
– Valdeir Psr
@Valdeirpsr I’m not sure if that’s it, I’ll see.
– PerduGames
@Valdeirpsr is not that, it’s different, the files are being created in the directory, I can’t keep changing the . htaccess for each file.
– PerduGames