Jump to content
WebFlake
  • 0

Can't use Friendly URL


Shahryar

Question

Hello guys,

I'd tried to enable Friendly URL option in Search Engine Optimization settings, but after activate and placing the htaccess file in the server, all posts, pages and forums show me " The page you requested does not exist".

I'd enabled three options in "Friendly URL" tab.

what is the problem?

help me plz.

Edited by Shahryar
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 1
12 minutes ago, Shahryar said:

No, it doesn't work.

we use nginx reverse proxy and apache. Can this be the problem?

Well if your using Nginx that means you need to setup nginx first as the .httaccess you are using only works for apache.

That information is quite critical to give next time you ask for help and something is not working btw.

 

The httaccess file you have would be this in nginx

# nginx configuration

location / {
  if (!-e $request_filename){
    rewrite \.(js|css|jpeg|jpg|gif|png|ico|map)(\?|$) /404error.php break;
  }
  if (!-e $request_filename){
    rewrite ^(.*)$ /index.php break;
  }
   if ($http_host !~ "^www.example.com$"){
    rewrite ^/(.*) http://blog.example.com/index.php/$1 [L, QSA] redirect;
  }
}

That is taken also what @Jeffrey into account.

Please do use with care and remember to modify to your needs

  • Like 1

VAEfvMI.png

Liked what i posted remember to feed me a cookie ->
Or you can add a cookie to myCookieJar

Link to comment
Share on other sites

  • 0

i think mod_security is not installed. this is my htaccess content:

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(js|css|jpeg|jpg|gif|png|ico|map)(\?|$) /404error.php [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Oh, I forgot to say that my forum is located in subdomain. subdomain name is "forums" and web address is like "https://forum.domain.com".

Edited by Shahryar
Link to comment
Share on other sites

  • 0
1 hour ago, Shahryar said:

i think mod_security is not installed. this is my htaccess content:


<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(js|css|jpeg|jpg|gif|png|ico|map)(\?|$) /404error.php [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Oh, I forgot to say that my forum is located in subdomain. subdomain name is "forums" and web address is like "https://forum.domain.com".

.htaccess so this is in a subdomain check your server and see what the issues sounds like is sever side if you have your .htaccess did u add the . in the front oh your file

when I load your site, I was like a vampire, slept for thousands of years and just now is my first glimpse of light haha.

Link to comment
Share on other sites

  • 0

Here's an example for the Rewrite Rule for subdomains:

 RewriteCond %{HTTP_HOST} !^www.example.com$
 RewriteCond %{HTTP_HOST} ^blog\.example.com$
 RewriteRule ^/(.*)         http://blog.example.com/index.php/$1 [L, QSA]

 

Edited by Jeffrey
  • Support Team - September 9th, 2017 - June 8, 2018
  • Junior Moderator - December 14th 2018 - November 16th, 2019
  • Designer - November 16th, 2019 - June 5th, 2020
  • Moderator - June 5th, 2020 - August 28th, 2020
Link to comment
Share on other sites

  • 0
12 hours ago, Jeffrey said:

Here's an example for the Rewrite Rule for subdomains:


 RewriteCond %{HTTP_HOST} !^www.example.com$
 RewriteCond %{HTTP_HOST} ^blog\.example.com$
 RewriteRule ^/(.*)         http://blog.example.com/index.php/$1 [L, QSA]

 

No, it doesn't work.

1 hour ago, Cookie Monster said:

Have you checked if you are using apache or nginx? If it's nginx the htaccess won't work and you need a different redirect method 

we use nginx reverse proxy and apache. Can this be the problem?

Edited by Shahryar
Link to comment
Share on other sites

  • 0
2 hours ago, Cookie Monster said:

That information is quite critical to give next time you ask for help and something is not working btw.

Sorry, I forgot it. I added this code to Custom HTTPD Configurations in directadmin, but it show me an error. The error is:

nginx: [emerg] invalid number of arguments in "rewrite" directive in /usr/local/directadmin/data/users/admin/nginx.conf:21
nginx: configuration file /etc/nginx/nginx.conf test failed

The code I entered is:

location / {
  if (!-e $request_filename){
    rewrite \.(js|css|jpeg|jpg|gif|png|ico|map)(\?|$) /404error.php break;
  }
  if (!-e $request_filename){
    rewrite ^(.*)$ /index.php break;
  }
   if ($http_host !~ "^www.mydomain.com$"){
    rewrite ^/(.*) https://forums.mydomain.com/index.php/$1 [L, QSA] redirect;
  }
}

The problem seems to be this:

rewrite ^/(.*) https://forums.mydomain.com/index.php/$1 [L, QSA] redirect;

?

Edited by Shahryar
Link to comment
Share on other sites

  • 0
The question(s) in this support topic have been answered and the topic author has resolved their issue. This topic is now closed. If you have other questions, please open a new topic.
  • Like 1
  • Support Team - September 9th, 2017 - June 8, 2018
  • Junior Moderator - December 14th 2018 - November 16th, 2019
  • Designer - November 16th, 2019 - June 5th, 2020
  • Moderator - June 5th, 2020 - August 28th, 2020
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...