htaccess url-rewriter page not found - php

i work in localhost and i need to rewrite url, when i write the url rewrited, a page like : 404 Not found This page not found on this server ...
But the directory is good
I already try to uncomment the line for mod_rewrite in httpdconf.conf
but not work
# URL REWRITING
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^esthetique$ /view/frontend/aestheticView.php [L]
RewriteRule ^forfait-fiancee-normal$ /view/frontend/forfaitFianceeBasicView.php [L]
RewriteRule ^forfait-mariee-normal$ /view/frontend/forfaitMarieeBasicView.php [L]
RewriteRule ^forfait-mariee-belle-dun-soir$ /view/frontend/forfaitMarieePremiumView.php [L]
RewriteRule ^forfaits$ /view/frontend/forfaitsView.php [L]
RewriteRule ^coiffure$ /view/frontend/hairView.php [L]
RewriteRule ^accueil$ /view/frontend/homeView.php [L]
RewriteRule ^mentions-legales$ /view/frontend/legalsView.php [L]
RewriteRule ^maquillage$ /view/frontend/makeupView.php [L]
RewriteRule ^packs-reductions$ /view/frontend/packsView.php [L]
RewriteRule ^politique$ /view/frontend/politiqueView.php [L]
When i go to the url mywebsite.ex/esthetique
He tell me :The requested URL /view/frontend/aestheticView.php was not found on this server.
And he work's when is online

Related

Htaccess redirect seems not working with php file extension to seo friendly (no extension) url

One of my website's old URL structures is like this:
https://example.com/login.php
or,
https://example.com/login.php?redirect=https://example.com
or,
https://example.com/register.php
after rebuilding the URLs, the URLs look like this:
https://example.com/login
or,
https://example.com/login?redirect=https://example.com
or,
https://example.com/register
Now when the user/visitor uses the old URL https://example.com/login.php, I want to redirect to the https://example.com/login page. How can I do it?
FYI, currently, my .htaccess file has the following content:
AddDefaultCharset UTF-8
ErrorDocument 404 /error-404/
##
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteBase /
## Allow a few SEO Files direct access.
RewriteRule ^robots.txt?$ robots.txt [L]
RewriteRule ^ads.txt?$ ads.txt [L]
RewriteRule ^sellers.json?$ sellers.json [L]
## Avoid rewriting rules for the admin section
RewriteRule ^(admin|resources)($|/) - [L]
## Set Ajax Request File
RewriteRule ^kahuk-ajax.php?$ kahuk-ajax.php? [L,QSA]
## Set controller with id
RewriteRule ^([^/]+)/([0-9]+)/?$ index.php?con=$1&id=$2 [L,QSA]
## Set controller with slug
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?con=$1&slug=$2 [L,QSA]
## For paging
RewriteRule ^([^/]+)/page/([0-9]+)/?$ index.php?con=$1&page=$2 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/page/([0-9]+)/?$ index.php?con=$1&slug=$2&page=$3 [L,QSA]
## Set controller for only one parameter
RewriteRule ^page/([^/]+)/?$ index.php?con=page&slug=$1 [L,QSA]
RewriteRule ^([^/]+)/?$ index.php?con=$1 [L,QSA]
## Set home page
RewriteRule ^/?$ index.php?con=home [L]
You can insert this rule just below RewriteBase / line to remove .php extension:
# To externally redirect /afile.php to /afile
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC]
RewriteRule !^admin/ /%1 [R=301,NE,L,NC]

Topic redirects with addition characters

I really appreciate the help you guys
have been rendering to people.
I am using Pretty URL for SMF.
I want to redirect a topic to another but the URL for the page which the Pretty URL gets the content it displays is attached to the URL after redirection.
Here is an example.
I used this in my .htaccess.
Redirect 301 /2030/ https://google.com
I am just testing, I am trying to redirect http://example.com/2030 to Google site address.
but when I redirect to Google, the URL contains:
https://www.google.com/?pretty;board=2030.0
pretty; board=2030 is the page which the http://example.com/2030 gets the content it displays.
How can I redirect to https://www.google.com without the
pretty;board=2030 showing.
Here is my entire .htaccess
# PRETTYURLS MOD BEGINS
# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: September 1, 2018, 16:50
RewriteEngine on
Redirect 301 /2030 https://google.com
RewriteBase /
# Rules for: profiles
RewriteRule ^profile/([^/]+)/?$ ./index.php?pretty;action=profile;user=$1 [L,QSA]
# Rules for: actions
RewriteRule ^(activate|admin|announce|attachapprove|buddy|calendar|clock|collapse)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(coppa|credits|deletemsg|display|dlattach|editpoll|editpoll2|emailuser)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(findmember|groups|help|helpadmin|im|jseditor|jsmodify|jsoption)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(lock|lockvoting|login|login2|logout|markasread|mergetopics|mlist)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(moderate|modifycat|modifykarma|movetopic|movetopic2|notify|notifyboard|openidreturn)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(pm|post|post2|printpage|profile|quotefast|quickmod|quickmod2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(recent|register|register2|reminder|removepoll|removetopic2|reporttm|requestmembers)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(restoretopic|search|search2|sendtopic|smstats|suggest|spellcheck|splittopics)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(stats|sticky|theme|trackip|about:mozilla|about:unknown|unread|unreadreplies)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(verificationcode|viewprofile|vote|viewquery|viewsmfile|who|\.xml|xmlhttp)/?$ ./index.php?pretty;action=$1 [L,QSA]
# Rules for: boards
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1.$2 [L,QSA]
# Rules for: topics
RewriteRule ^([0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;topic=$1.0 [L,QSA]
RewriteRule ^([0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ ./index.php?pretty;topic=$1.$3 [L,QSA]
# PRETTYURLS MOD ENDS
Replace
Redirect 301 /2030 https://google.com
with
RewriteRule "(.)*/2030$" "https://google.com" [R=301,L]

Facebook Login wont work on mod_rewrited urls

Facebook sign in worked perfectly until i created .htaccess and rewrote URL-s
Now when i pressing on sign in button its changing link and adding ?code= and after this if i'm pressing from homepage its signing me in but if it on rewrote page its doing nothing. I have tried to change rewrite rules.
RewriteEngine on
RewriteRule ^movie/([^/]*)$ /?movie=$1
RewriteRule ^movie/([^/]*)/credits$ /?movie=$1&dir=movie_credits
RewriteRule ^movie/([^/]*)/images$ /?movie=$1&dir=movie_images
RewriteRule ^tv/([^/]*)$ /?tv=$1
RewriteRule ^tv/([^/]*)/credits$ /?tv=$1&dir=tv_credits
RewriteRule ^tv/([^/]*)/images$ /?tv=$1&dir=tv_images
RewriteRule ^name/([^/]*)$ /?person=$1
RewriteRule ^name/([^/]*)/credits$ /?person=$1&dir=person_credits
RewriteRule ^name/([^/]*)/images$ /?person=$1&dir=person_images
RewriteRule ^user/([^/]*)$ /?user=$1
RewriteRule ^user/([^/]*)/movies/favlist$ /?user=$1&dir=movies_favlist
RewriteRule ^user/([^/]*)/movies/watchlist$ /?user=$1&dir=movies_watchlist
RewriteRule ^user/([^/]*)/people/favlist$ /?user=$1&dir=people_favlist
RewriteRule ^user/([^/]*)/tv/favlist$ /?user=$1&dir=tv_favlist
RewriteRule ^user/([^/]*)/tv/watchlist$ /?user=$1&dir=tv_watchlist
RewriteRule ^genre/([^/]*)$ /?discover&genres=$1
RewriteRule ^genre/tv/([^/]*)$ /?discover=tv&genres=$1
RewriteRule ^tv/([^/]*)/season/([^/]*)$ /?tv=$1&dir=seasons&season=$2
RewriteRule ^discover/movies$ /?discover
RewriteRule ^discover/tv$ /?discover=tv
RewriteRule ^discover/people$ /?people
RewriteRule ^discover/people/page([^/]*)$ /?people&page=$1
RewriteRule ^discover/users$ /?users
RewriteRule ^register$ /?user=register
there's more to your htaccess file that needs to be looked at if you don't want an answer that's fine, but you need to show more

Rewriterule - urls dont change in the browser bar

It's very strange to me, but:
I have a website with guestbook-add.php. I want to show it to the visitors as gasterbuch.html.
So I have written in .htaccess (my real domain has been changed in that listing to http://mywebsite.com/ of course):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ http://mywebsite.com/index.php [L]
RewriteRule ^gasterbuch.html$ http://mywebsite.com/guestbook-list.php
RewriteRule ^eintrag-hinzufugen.html$ http://mywebsite.com/guestbook-add.php
</IfModule>
Now, when I type in the browser http://mywebsite.com/gasterbuch.html, I see the text generated by guestbook-add.php (which is fine).
But in the browser url bar, I see http://mywebsite.com/guestbook-add.php instead of http://mywebsite.com/gasterbuch.html (like it was the 302 redirect).
What am I doing wrong?
Changing
RewriteRule ^index.html$ http://mywebsite.com/index.php [L]
RewriteRule ^gasterbuch.html$ http://mywebsite.com/guestbook-list.php
RewriteRule ^eintrag-hinzufugen.html$ http://mywebsite.com/guestbook-add.php
to
RewriteRule ^index.html$ /index.php [L]
RewriteRule ^gasterbuch.html$ /guestbook-list.php [L]
RewriteRule ^eintrag-hinzufugen.html$ /guestbook-add.php [L]
should work.

"RewriteBase: argument is not a valid URL" error

I'm trying to configure .htaccess of my website.
http://213.175.210.49/~incisozl/ is the temporary url to the root(~/public_html/).
when I try to rewrite the url at .htaccess i get an
/home/incisozl/public_html/.htaccess: RewriteBase: argument is not a valid URL, referer: ht tp://213.175.210.49/~incisozl/inci-sozluk/somestring
error.
my rewrite rule is;
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/?$ /index.php [L]
RewriteRule ^inci-sozluk/([^\.\?/]+)/([0-9]+)/?$ /seo.php?process=word&q=$1&sayfa=$2 [L]
RewriteRule ^inci-sozluk/([^\.\?/]+)?$ /seo.php?process=word&q=$1 [L]
RewriteRule ^inci-sozluk/([^\.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=word&q=$1&sayfa=$2&gid=$3 [L]
RewriteRule ^inci-sozluktest/([^\.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=wordtest&q=$1&sayfa=$2&gid=$3 [L]
RewriteRule ^inci-sozluk-bugun/([^\.\?/]+)/([0-9]+)/?$ /seo.php?process=wordbg&q=$1&sayfa=$2 [L]
RewriteRule ^inci-sozluk-bugun/([^\.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=wordbg&q=$1&sayfa=$2&gid=$3 [L]
RewriteRule ^inci-sozluk-dun/([^\.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=worddn&q=$1&sayfa=$2&gid=$3 [L]
RewriteRule ^inci-sozluk-dun/([^\.\?/]+)/([0-9]+)/?$ /seo.php?process=worddn&q=$1&sayfa=$2 [L]
RewriteRule ^inci-sozluk-ters/([^\.\?/]+)/([0-9]+)/?$ /seo.php?process=wordts&q=$1&sayfa=$2 [L]
RewriteRule ^inci-sozluk-ters/([^\.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=wordts&q=$1&sayfa=$2&gid=$3 [L]
RewriteRule ^inci-sozluk-cvpters/([^\.\?/]+)/([0-9]+)/?$ /seo.php?process=cvpwordts&q=$1&sayfa=$2 [L]
RewriteRule ^inci-sozluk-cvpters/([^\.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=cvpwordts&q=$1&sayfa=$2&gid=$3 [L]
RewriteRule ^inci-sozluk-ileti/([0-9]+)/?$ /seo.php?process=eid&eid=$1 [L]
RewriteRule ^inci-sozluk-ileticvp/([0-9]+)/?$ /seo.php?process=cvpeid&eid=$1 [L]
</IfModule>
btw. it works fine when i use it with www.incisozluk.org pointed domain
That's strange since the only place where this error message is generated is in
cmd_rewritebase() in modules/mappers/mod_rewrite.c and the code is
if (a1[0] != '/') {
return "RewriteBase: argument is not a valid URL";
}
It tests whether the first character of the new value for RewriteBase is a /.
According to the code you've posted that is the case. Could there be another .htaccess file that has an invalid value?
This is archaically old, but I just ran into this and for me the issue was having a slash on both the RewriteBase line and the RewriteRule line's destination. I took the slash off the destination and the error went away!

Categories